Skip to content

Commit

Permalink
Fixes #315
Browse files Browse the repository at this point in the history
  • Loading branch information
isc-bsaviano committed Apr 15, 2024
1 parent c864531 commit af99740
Show file tree
Hide file tree
Showing 12 changed files with 450 additions and 27 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
- Fix issue [#312](https://github.com/intersystems/language-server/issues/312): Fix routine existence diagnostics for routines that only exist in OBJ form
- Fix issue [#313](https://github.com/intersystems/language-server/issues/313): Add Diagnostic when `ROUTINE` header is missing
- Fix issue [#314](https://github.com/intersystems/language-server/issues/314): Suggest boolean class keywords for completion after typing `Not`
- Fix issue [#315](https://github.com/intersystems/language-server/issues/315): Add warning diagnostics for SQL reserved words in class and property names of persistent classes
- Fix issue [#316](https://github.com/intersystems/language-server/issues/316): Show class description when hovering over a typed variable
- Fix issue [#317](https://github.com/intersystems/language-server/issues/317): Add `DocumentLink` for `##class()` in class description comments
- Fix issue [#318](https://github.com/intersystems/language-server/issues/318): Support optional chaining operator in JavaScript colorer
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ This is a [LSP](https://microsoft.github.io/language-server-protocol/) compliant
- Mismatches between declared UDL Parameter types and the assigned value.
- Classes, Methods, Parameters and Properties that are [Deprecated](https://docs.intersystems.com/irislatest/csp/docbook/Doc.View.cls?KEY=ROBJ_method_deprecated).
- `$ZUTIL` functions that [are deprecated or have been superseded](https://docs.intersystems.com/latest/csp/docbook/DocBook.UI.Page.cls?KEY=RCOS_replacements).
- [SQL reserved words](https://docs.intersystems.com/irislatest/csp/docbook/DocBook.UI.Page.cls?KEY=RSQL_reservedwords) used in class and property names of persistent classes.
- [Folding Ranges](https://code.visualstudio.com/docs/editor/codebasics#_folding) for the following:
- ObjectScript code blocks (If/ElseIf/Else, Try/Catch, For, While, etc.)
- UDL class members
Expand Down
6 changes: 6 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,12 @@
]
},
"description": "Controls the languages that syntax error diagnosics will be suppressed for."
},
"intersystems.language-server.diagnostics.sqlReserved": {
"scope": "resource",
"type": "boolean",
"default": true,
"markdownDescription": "Controls whether diagnostics are provided when a [SQL reserved word](https://docs.intersystems.com/irislatest/csp/docbook/DocBook.UI.Page.cls?KEY=RSQL_reservedwords) is used in a class or property name of a persistent class."
}
}
},
Expand Down
279 changes: 279 additions & 0 deletions server/src/documentation/sqlReservedWords.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,279 @@
[
"%AFTERHAVING",
"%ALLINDEX",
"%ALPHAUP",
"%ALTER",
"%BEGTRANS",
"%CHECKPRIV",
"%CLASSNAME",
"%CLASSPARAMETER",
"%DBUGFULL",
"%DELDATA",
"%DESCRIPTION",
"%EXACT",
"%EXTERNAL",
"%FILE",
"%FIRSTTABLE",
"%FLATTEN",
"%FOREACH",
"%FULL",
"%ID",
"%IDADDED",
"%IGNOREINDEX",
"%IGNOREINDICES",
"%INLIST",
"%INORDER",
"%INTERNAL",
"%INTEXT",
"%INTRANS",
"%INTRANSACTION",
"%KEY",
"%MATCHES",
"%MCODE",
"%MERGE",
"%MINUS",
"%MVR",
"%NOCHECK",
"%NODELDATA",
"%NOFLATTEN",
"%NOFPLAN",
"%NOINDEX",
"%NOLOCK",
"%NOMERGE",
"%NOPARALLEL",
"%NOREDUCE",
"%NORUNTIME",
"%NOSVSO",
"%NOTOPOPT",
"%NOTRIGGER",
"%NOUNIONOROPT",
"%NUMROWS",
"%ODBCIN",
"%ODBCOUT",
"%PARALLEL",
"%PLUS",
"%PROFILE",
"%PROFILE_ALL",
"%PUBLICROWID",
"%ROUTINE",
"%ROWCOUNT",
"%RUNTIMEIN",
"%RUNTIMEOUT",
"%STARTSWITH",
"%STARTTABLE",
"%SQLSTRING",
"%SQLUPPER",
"%STRING",
"%TABLENAME",
"%TRUNCATE",
"%UPPER",
"%VALUE",
"%VIDABSOLUTE",
"ADD",
"ALL",
"ALLOCATE",
"ALTER",
"AND",
"ANY",
"ARE",
"AS",
"ASC",
"ASSERTION",
"AT",
"AUTHORIZATION",
"AVG",
"BEGIN",
"BETWEEN",
"BIT",
"BIT_LENGTH",
"BOTH",
"BY",
"CASCADE",
"CASE",
"CAST",
"CHAR",
"CHARACTER",
"CHARACTER_LENGTH",
"CHAR_LENGTH",
"CHECK",
"CLOSE",
"COALESCE",
"COLLATE",
"COMMIT",
"CONNECT",
"CONNECTION",
"CONSTRAINT",
"CONSTRAINTS",
"CONTINUE",
"CONVERT",
"CORRESPONDING",
"COUNT",
"CREATE",
"CROSS",
"CURRENT",
"CURRENT_DATE",
"CURRENT_TIME",
"CURRENT_TIMESTAMP",
"CURRENT_USER",
"CURSOR",
"DATE",
"DEALLOCATE",
"DEC",
"DECIMAL",
"DECLARE",
"DEFAULT",
"DEFERRABLE",
"DEFERRED",
"DELETE",
"DESC",
"DESCRIBE",
"DESCRIPTOR",
"DIAGNOSTICS",
"DISCONNECT",
"DISTINCT",
"DOMAIN",
"DOUBLE",
"DROP",
"ELSE",
"END",
"ENDEXEC",
"ESCAPE",
"EXCEPT",
"EXCEPTION",
"EXEC",
"EXECUTE",
"EXISTS",
"EXTERNAL",
"EXTRACT",
"FALSE",
"FETCH",
"FIRST",
"FLOAT",
"FOR",
"FOREIGN",
"FOUND",
"FROM",
"FULL",
"GET",
"GLOBAL",
"GO",
"GOTO",
"GRANT",
"GROUP",
"HAVING",
"HOUR",
"IDENTITY",
"IMMEDIATE",
"IN",
"INDICATOR",
"INITIALLY",
"INNER",
"INPUT",
"INSENSITIVE",
"INSERT",
"INT",
"INTEGER",
"INTERSECT",
"INTERVAL",
"INTO",
"IS",
"ISOLATION",
"JOIN",
"LANGUAGE",
"LAST",
"LEADING",
"LEFT",
"LEVEL",
"LIKE",
"LOCAL",
"LOWER",
"MATCH",
"MAX",
"MIN",
"MINUTE",
"MODULE",
"NAMES",
"NATIONAL",
"NATURAL",
"NCHAR",
"NEXT",
"NO",
"NOT",
"NULL",
"NULLIF",
"NUMERIC",
"OCTET_LENGTH",
"OF",
"ON",
"ONLY",
"OPEN",
"OPTION",
"OR",
"OUTER",
"OUTPUT",
"OVERLAPS",
"PAD",
"PARTIAL",
"PREPARE",
"PRESERVE",
"PRIMARY",
"PRIOR",
"PRIVILEGES",
"PROCEDURE",
"PUBLIC",
"READ",
"REAL",
"REFERENCES",
"RELATIVE",
"RESTRICT",
"REVOKE",
"RIGHT",
"ROLE",
"ROLLBACK",
"ROWS",
"SCHEMA",
"SCROLL",
"SECOND",
"SECTION",
"SELECT",
"SESSION_USER",
"SET",
"SHARD",
"SMALLINT",
"SOME",
"SPACE",
"SQLERROR",
"SQLSTATE",
"STATISTICS",
"SUBSTRING",
"SUM",
"SYSDATE",
"SYSTEM_USER",
"TABLE",
"TEMPORARY",
"THEN",
"TIME",
"TIMEZONE_HOUR",
"TIMEZONE_MINUTE",
"TO",
"TOP",
"TRAILING",
"TRANSACTION",
"TRIM",
"TRUE",
"UNION",
"UNIQUE",
"UPDATE",
"UPPER",
"USER",
"USING",
"VALUES",
"VARCHAR",
"VARYING",
"WHEN",
"WHENEVER",
"WHERE",
"WITH",
"WORK",
"WRITE"
]
7 changes: 1 addition & 6 deletions server/src/providers/definition.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Position, TextDocumentPositionParams, Range } from 'vscode-languageserver/node';
import { getServerSpec, findFullRange, normalizeClassname, makeRESTRequest, createDefinitionUri, getMacroContext, isMacroDefinedAbove, quoteUDLIdentifier, getClassMemberContext, determineClassNameParameterClass, getParsedDocument, currentClass, getTextForUri } from '../utils/functions';
import { ServerSpec, QueryData } from '../utils/types';
import { documents, corePropertyParams } from '../utils/variables';
import { documents, corePropertyParams, classMemberTypes } from '../utils/variables';
import * as ld from '../utils/languageDefinitions';

/**
Expand All @@ -10,11 +10,6 @@ import * as ld from '../utils/languageDefinitions';
*/
const definitionTargetRangeMaxLines: number = 10;

/**
* An array containing all UDL class member types.
*/
const classMemberTypes: string[] = ["Parameter","Property","Relationship","ForeignKey","Index","Query","Storage","Trigger","XData","Projection","Method","ClassMethod","ClientMethod"];

export async function onDefinition(params: TextDocumentPositionParams) {
const doc = documents.get(params.textDocument.uri);
if (doc === undefined) {return null;}
Expand Down
Loading

0 comments on commit af99740

Please sign in to comment.