mssql-lsp

command module
v0.0.0-...-57587c4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 26, 2026 License: MIT Imports: 10 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

tsql-ls: T-SQL Language Server

A Language Server Protocol (LSP) implementation for T-SQL, forked from sqls and specialized for Microsoft SQL Server.

Features

LSP Capabilities
  • Completion — keywords, tables, columns, schemas, joins, system stored procedures, snippets
  • Hover — column types, table details, object info
  • Go to Definition / Type Definition / Declaration — navigate to CTEs, temp tables, variables, table aliases
  • References & Highlights — find all references, document highlights
  • Rename & Prepare Rename — safe symbol renaming with preview
  • Signature Help — function parameter hints
  • Formatting — full document, range, and on-type formatting
  • Code Actions — 6 actions (quick fixes for unclosed blocks, remove unused CTEs, surround with TRY/CATCH)
  • Diagnostics — 16 rules (unclosed blocks, duplicate variables, undefined variables, unreferenced CTEs, transaction mismatches, and more)
  • Folding Ranges — collapse BEGIN/END, TRY/CATCH, IF/ELSE, multi-line comments
  • Document & Workspace Symbols — outline view and cross-file symbol search
  • Selection Range — smart expand/shrink selection
  • Semantic Tokens — full, range, and delta semantic highlighting
  • Inlay Hints — inline type annotations
  • Linked Editing — synchronized editing of related identifiers
T-SQL Specifics
  • [bracket] quoted identifiers
  • @variables and @@globals
  • #temp and ##global_temp tables
  • GO batch separator — all operations are batch-aware
  • BEGIN/END, TRY/CATCH, IF/ELSE block parsing

Installation

go install github.com/atornesi/tsql-ls@latest

Configuration

Configuration Methods (in priority order)
  1. -config CLI flag
  2. workspace/configuration from LSP client
  3. $XDG_CONFIG_HOME/sqls/config.yml (defaults to ~/.config/sqls/config.yml)
Configuration File
lowercaseKeywords: false
connections:
  - alias: local_mssql
    driver: mssql
    dataSourceName: "sqlserver://user:password@localhost:1433?database=mydb"
  - alias: individual_mssql
    driver: mssql
    proto: tcp
    user: sa
    passwd: YourPassword
    host: 127.0.0.1
    port: 1433
    dbName: mydb

The first connection in the list is the default.

Key Description
alias Connection alias name. Optional.
driver mssql. Required.
dataSourceName DSN (takes precedence over individual fields).
proto tcp, udp, unix.
user User name.
passwd Password.
host Host.
port Port.
dbName Database name.
params Additional parameters. Optional.

Editor Setup

Neovim (nvim-lspconfig)
require('lspconfig').sqls.setup {
  cmd = { 'tsql-ls', '-config', vim.fn.expand('~/.config/sqls/config.yml') },
  filetypes = { 'sql' },
  settings = {
    sqls = {
      connections = {
        {
          driver = 'mssql',
          dataSourceName = 'sqlserver://sa:password@localhost:1433?database=mydb',
        },
      },
    },
  },
}
VS Code

Use a generic LSP client extension (e.g., vscode-lsp-sample) pointing to the tsql-ls binary.

Other Editors

Any editor with LSP client support can use tsql-ls. Point the client to the tsql-ls binary with --stdio transport (the default).

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
ast
pkg
lsp

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
⌂ 换网址