fix(sql): add missing T-SQL keywords to sqlserver completion

This commit is contained in:
zipg authored and GitHub committed 2026-09-21 01:33:57 +08:00
1 parent 510fac6665
commit 221683950d
3 files changed
+91

No files matched your search

+67
View File
@@ -534,6 +534,73 @@ const SQLSERVER_SQL_KEYWORDS = [
"SHOWPLAN_ALL",
"SHOWPLAN_TEXT",
"SHOWPLAN_XML",
// T-SQL statements and control flow. `DECLARE` in particular is what issue #9319 reported:
// typing `decl` only offered `DECIMAL`, so scripting a batch had no completion at all.
"DECLARE",
"EXEC",
"EXECUTE",
"PRINT",
"RETURN",
"IF",
"WHILE",
"BREAK",
"CONTINUE",
"GOTO",
"WAITFOR",
"RAISERROR",
"THROW",
"TRY",
"CATCH",
"BEGIN TRY",
"BEGIN CATCH",
"BEGIN TRANSACTION",
"COMMIT TRANSACTION",
"ROLLBACK TRANSACTION",
"SAVE TRANSACTION",
"TRIGGER",
"PROCEDURE",
"FUNCTION",
"RETURNS",
"PIVOT",
"UNPIVOT",
"CROSS APPLY",
"OUTER APPLY",
"OPTION",
"RECOMPILE",
"MAXRECURSION",
// Frequently used T-SQL functions and session/system values. Built-in functions with
// parameter signatures (CONVERT, ISNULL, GETDATE, NEWID, STUFF, ...) are completed from
// SQLSERVER_FUNCTION_SIGNATURES instead; buildKeywordItems filters keywords that already
// have a signature, so they are not duplicated here. IIF has no SQL Server signature
// entry and is therefore listed as a keyword.
"IIF",
"CHOOSE",
"STRING_AGG",
"OBJECT_ID",
"SCOPE_IDENTITY",
"IDENT_CURRENT",
"SP_EXECUTESQL",
"SYSTEM_USER",
"SESSION_USER",
"CURRENT_USER",
"USER_NAME",
"SCHEMA_NAME",
"DATABASEPROPERTYEX",
"XACT_STATE",
"ERROR_MESSAGE",
"ERROR_NUMBER",
"ERROR_SEVERITY",
"ERROR_STATE",
"ERROR_LINE",
"ERROR_PROCEDURE",
"@@ERROR",
"@@IDENTITY",
"@@ROWCOUNT",
"@@TRANCOUNT",
"@@FETCH_STATUS",
"@@SERVERNAME",
"@@VERSION",
"@@SPID",
];
function sqlDialectCompletionWords(...sources: Array<string | undefined>): string[] {