@sap/cds-lsp
Advanced tools
Comparing version 8.3.2 to 8.4.2
@@ -10,2 +10,22 @@ # Changelog | ||
## 8.4.2 - 2024-11-02 | ||
### Added | ||
- Rename or move of CDS files and folders will update all `using` statements to the renamed file | ||
- Deletion of CDS files or folders will show all `using` statements to the renamed file with possibility to remove those. | ||
Note: The referencing files will likely have compilation errors afterward. | ||
### Fixed | ||
- highlighting of escaped identifiers and parameter lists | ||
- `using` path proposals could have been suggesting JS files instead of CDS files in certain cases | ||
- on Windows if client mixes upper- and lowercase drive letters some requests could have failed | ||
- CDS Typer was called when deleting a file which led to a misleading error output | ||
- Analysis of dependencies failed when handling non-npm `package.json` files (e.g. from `pnpm` lacking `name` property) | ||
### Changed | ||
- minimum required NodeJS version is now (back to) 20.9.0 | ||
### Also see | ||
- `@sap/cds-compiler` 5.4.0 | ||
## 8.3.2 - 2024-10-01 | ||
@@ -22,2 +42,5 @@ | ||
### Changed | ||
- minimum required NodeJS version is now 20.15.1 | ||
### Also see | ||
@@ -24,0 +47,0 @@ - `@sap/cds-compiler` 5.3.0 |
@@ -48,2 +48,9 @@ import * as LSP from 'vscode-languageserver-protocol'; | ||
}>; | ||
usings?: Array<{ | ||
location: XsnLocation; | ||
fileDep?: { | ||
location: XsnLocation; | ||
val: UsingPath; | ||
}; | ||
}>; | ||
options: CdscParseOptions; | ||
@@ -50,0 +57,0 @@ tokens: unknown[]; |
@@ -44,2 +44,9 @@ import { BigIntStats, Dirent, PathLike, StatOptions, Stats, WriteFileOptions } from 'node:fs'; | ||
}>; | ||
usings?: Array<{ | ||
location: XsnLocation; | ||
fileDep?: { | ||
location: XsnLocation; | ||
val: UsingPath; | ||
}; | ||
}>; | ||
options: CdscParseOptions; | ||
@@ -1069,3 +1076,6 @@ tokens: unknown[]; | ||
} | ||
export type IWorkspaceDocumentsWithPossibleDeletions = Map<Uri, FileContent | T_FILE_DOES_NOT_EXIST>; | ||
export type IWorkspaceDocumentsWithPossibleDeletions = Map<Uri, { | ||
content: FileContent | T_FILE_DOES_NOT_EXIST; | ||
version: number | null; | ||
}>; | ||
declare enum WorkspaceValidationMode { | ||
@@ -1133,2 +1143,12 @@ ActiveEditorOnly = "ActiveEditorOnly", | ||
} | ||
export interface _IMaintainTranslationArg { | ||
sourceFileUri: FileUri; | ||
translationFileUri: FileUri; | ||
tID: string; | ||
range: LSP.Range; | ||
text: string; | ||
replaceTextWithTranslationKey: boolean; | ||
translationType: TranslationType; | ||
doCreateTranslationFile: boolean; | ||
} | ||
export type TranslationType = "XTIT" | "XTOL" | "XMSG"; | ||
@@ -1207,2 +1227,3 @@ export interface _II18nIndex { | ||
} | ||
export type CdsExecuteParams = Omit<MigrateDeprecatedDelimiterCommand | DocCommentCommand | TranslationCommand | RemoveUnusedImportArgsCommand | ImportArtifactCommand, "title"> | IFormatRangeParams | IAnalyzeDependenciesParams | IActiveEditorChangedParams; | ||
export interface IQuickFixHandler { | ||
@@ -1212,3 +1233,3 @@ readonly id: QuickFixCommands; | ||
createCodeActions(params: LSP.CodeActionParams): Promise<LSP.CodeAction[]>; | ||
execute(params: LSP.ExecuteCommandParams): Promise<any>; | ||
execute(params: CdsExecuteParams): Promise<any>; | ||
} | ||
@@ -1218,7 +1239,7 @@ declare const CommandNames: readonly [ | ||
"analyze-dependencies", | ||
"active-editor-changed", | ||
"parse-tree" | ||
"active-editor-changed" | ||
]; | ||
export type CommandName = typeof CommandNames[number]; | ||
export interface ICommandHandler { | ||
readonly id: CommandName; | ||
execute(params: LSP.ExecuteCommandParams): Promise<unknown>; | ||
@@ -1229,2 +1250,13 @@ } | ||
} | ||
export interface IFormatRangeParams extends ICdsExecuteCommandParams { | ||
command: "format-range"; | ||
arguments: [ | ||
IFormatRangeArguments | ||
]; | ||
} | ||
export interface IFormatRangeArguments { | ||
uri: Uri; | ||
position: LSP.Position; | ||
offsetFromEnd: number; | ||
} | ||
export interface IAnalyzeDependenciesParams extends ICdsExecuteCommandParams { | ||
@@ -1253,3 +1285,3 @@ command: "analyze-dependencies"; | ||
previousActiveUri: Uri | undefined; | ||
newActiveUri: Uri; | ||
newActiveUri: Uri | undefined; | ||
} | ||
@@ -1322,2 +1354,3 @@ export interface DiagnosticsState { | ||
content: FileContent; | ||
version: number | null; | ||
fileIndex?: _IFileIndex; | ||
@@ -1327,3 +1360,3 @@ readonly uri: Uri; | ||
readonly isOutsider: boolean; | ||
progress(newContent: FileContent, isOpen: boolean): _IWorkspaceFileVersion; | ||
progress(newContent: FileContent, version: number | null, isOpen: boolean): _IWorkspaceFileVersion; | ||
} | ||
@@ -1358,3 +1391,3 @@ export type WorkspaceFiles = Map<Uri, _IWorkspaceFileVersion>; | ||
createSnapshot(context: _IWorkspaceStateContext, scanning: boolean): _IWorkspaceSnapshot; | ||
createFile(uri: Uri, content: FileContent, isOpen?: boolean): _IWorkspaceFileVersion; | ||
createFile(uri: Uri, content: FileContent, version: number | null, isOpen?: boolean): _IWorkspaceFileVersion; | ||
createCompiler(options: ILspOptions, loader: _IModuleLoader): _ICompiler; | ||
@@ -1514,2 +1547,53 @@ createCdsTyperWrapper(server: _ILanguageServer): ICdsTyperWrapper; | ||
} | ||
export interface MigrateDeprecatedDelimiterArgs { | ||
uri: Uri; | ||
diagnostic: LSP.Diagnostic; | ||
} | ||
export interface MigrateDeprecatedDelimiterCommand extends LSP.Command { | ||
arguments: [ | ||
MigrateDeprecatedDelimiterArgs | ||
]; | ||
command: QuickFixCommands.MIGRATE_DEPRECATED_DELIMITER; | ||
} | ||
export interface MigrateToDocCommentArgs { | ||
uri: Uri; | ||
diagnostic: LSP.Diagnostic; | ||
} | ||
export interface DocCommentCommand extends LSP.Command { | ||
arguments: [ | ||
MigrateToDocCommentArgs | ||
]; | ||
command: QuickFixCommands.MIGRATE_TO_DOCCOMMENT; | ||
} | ||
export interface TranslationCommand extends LSP.Command { | ||
arguments: [ | ||
_IMaintainTranslationArg | ||
]; | ||
command: QuickFixCommands.MAINTAIN_TRANSLATION; | ||
} | ||
export interface RemoveUnusedImportArgsCommand extends LSP.Command { | ||
arguments: [ | ||
RemoveUnusedImportArgs | ||
]; | ||
command: QuickFixCommands.REMOVE_UNUSED_IMPORT; | ||
} | ||
export interface RemoveUnusedImportArgs { | ||
uri: Uri; | ||
rangesToRemoveForStatementId: Array<{ | ||
id: number; | ||
ranges: LSP.Range[]; | ||
}>; | ||
} | ||
export interface ImportArtifactCommand extends LSP.Command { | ||
arguments: [ | ||
ImportArtifactArgs | ||
]; | ||
command: QuickFixCommands.IMPORT_ARTIFACT; | ||
} | ||
export interface ImportArtifactArgs { | ||
uri: Uri; | ||
importUri: Uri; | ||
fqn: string; | ||
kind: XsnKind; | ||
} | ||
export declare class ServerStarter { | ||
@@ -1516,0 +1600,0 @@ private readonly factory; |
@@ -17,3 +17,3 @@ # Installation | ||
#### Requirements | ||
`@sap/cds-lsp` is a NodeJS module. As such it requires NodeJS installed on the client machine. Minimum version is 20.14. | ||
`@sap/cds-lsp` is a NodeJS module. As such it requires NodeJS installed on the client machine. Minimum version is 20.15.1 | ||
@@ -20,0 +20,0 @@ #### Start-up |
{ | ||
"name": "@sap/cds-lsp", | ||
"description": "Language server for CDS", | ||
"version": "8.3.2", | ||
"version": "8.4.2", | ||
"homepage": "https://cap.cloud.sap/", | ||
@@ -40,5 +40,5 @@ "author": "SAP SE (https://www.sap.com)", | ||
"@mischnic/json-sourcemap": "0.1.1", | ||
"@sap/cds-compiler": "5.3.x", | ||
"@sap/cds-compiler": "5.4.x", | ||
"ignore": "6.0.2", | ||
"marked": "14.1.0", | ||
"marked": "14.1.3", | ||
"tiny-typed-emitter": "2.1.0", | ||
@@ -45,0 +45,0 @@ "vscode-languageserver": "9.0.1", |
@@ -11,2 +11,8 @@ { | ||
{ | ||
"include": "#serviceDef" | ||
}, | ||
{ | ||
"include": "#actionOrFunctionDef" | ||
}, | ||
{ | ||
"include": "#aspectDefOrEntityDefOrTypeDefOrEventDefOrAnnotate" | ||
@@ -160,27 +166,2 @@ }, | ||
{ | ||
"begin": "(?i)\\b(action|function)\\s+([$_\\p{ID_Start}][$\\p{ID_Continue}\\u200C\\u200D]*)\\s*(\\()", | ||
"beginCaptures": { | ||
"1": { | ||
"name": "keyword.strong.cds" | ||
}, | ||
"2": { | ||
"name": "entity.name.function.cds" | ||
}, | ||
"3": { | ||
"name": "punctuation.definition.parameters.begin.cds" | ||
} | ||
}, | ||
"end": "\\)", | ||
"endCaptures": { | ||
"0": { | ||
"name": "punctuation.definition.parameters.end.cds" | ||
} | ||
}, | ||
"patterns": [ | ||
{ | ||
"include": "#function-params" | ||
} | ||
] | ||
}, | ||
{ | ||
"captures": { | ||
@@ -236,3 +217,3 @@ "1": { | ||
{ | ||
"match": "\\;", | ||
"match": ";", | ||
"name": "punctuation.terminator.statement.cds" | ||
@@ -426,21 +407,2 @@ }, | ||
}, | ||
"function-params": { | ||
"name": "function-params", | ||
"patterns": [ | ||
{ | ||
"match": "\"[^\"]*(?:\"\"[^\"]*)*\"|!\\[[^\\]]*(?:\\]\\][^\\]]*)*\\]|[$_\\p{ID_Start}][$\\p{ID_Continue}\\u200C\\u200D]*", | ||
"name": "variable.parameter.function.cds" | ||
}, | ||
{ | ||
"match": ",", | ||
"name": "punctuation.separator.object.cds" | ||
}, | ||
{ | ||
"include": "#comment" | ||
}, | ||
{ | ||
"include": "#operator" | ||
} | ||
] | ||
}, | ||
"number": { | ||
@@ -614,3 +576,3 @@ "name": "number", | ||
"name": "elementDef", | ||
"begin": "(?!\\s*@)(?:(?=\\()|\\b(virtual(?:\\s+))?(key(?:\\s+))?(masked(?:\\s+))?(element(?:\\s+))?)", | ||
"begin": "(?:^|\\G)\\s*(?!extend)(virtual(?:\\s+))?(key(?:\\s+))?(masked(?:\\s+))?(element(?:\\s+))?(?=\\S)", | ||
"beginCaptures": { | ||
@@ -723,2 +685,40 @@ "1": { | ||
}, | ||
"bracedArtifactDefOrExtend": { | ||
"name": "bracedArtifactDefOrExtend", | ||
"begin": "{", | ||
"beginCaptures": { | ||
"0": { | ||
"name": "punctuation.section.scope.begin.cds" | ||
} | ||
}, | ||
"end": "}", | ||
"endCaptures": { | ||
"0": { | ||
"name": "punctuation.section.scope.end.cds" | ||
} | ||
}, | ||
"patterns": [ | ||
{ | ||
"include": "#comment" | ||
}, | ||
{ | ||
"include": "#atAnnoParen" | ||
}, | ||
{ | ||
"include": "#atAnnoNoParen" | ||
}, | ||
{ | ||
"include": "#serviceDef" | ||
}, | ||
{ | ||
"include": "#actionOrFunctionDef" | ||
}, | ||
{ | ||
"include": "#aspectDefOrEntityDefOrTypeDefOrEventDefOrAnnotate" | ||
}, | ||
{ | ||
"include": "#keyword" | ||
} | ||
] | ||
}, | ||
"bracedSelectItemDef": { | ||
@@ -754,5 +754,52 @@ "name": "bracedSelectItemDef", | ||
}, | ||
"parameterListDef": { | ||
"name": "parameterListDef", | ||
"begin": "\\(", | ||
"beginCaptures": { | ||
"0": { | ||
"name": "punctuation.definition.parameters.begin.cds" | ||
} | ||
}, | ||
"end": "\\)", | ||
"endCaptures": { | ||
"0": { | ||
"name": "punctuation.definition.parameters.end.cds" | ||
} | ||
}, | ||
"patterns": [ | ||
{ | ||
"include": "#comment" | ||
}, | ||
{ | ||
"include": "#atAnnoParen" | ||
}, | ||
{ | ||
"include": "#atAnnoNoParen" | ||
}, | ||
{ | ||
"include": "#keyword" | ||
}, | ||
{ | ||
"comment": "parameter name", | ||
"match": "(?<!@)(?:\"[^\"]*(?:\"\"[^\"]*)*\"|!\\[[^\\]]*(?:\\]\\][^\\]]*)*\\]|[$_\\p{ID_Start}][$\\p{ID_Continue}\\u200C\\u200D]*)(?=\\s*[:{@])", | ||
"name": "variable.parameter.function.cds" | ||
}, | ||
{ | ||
"include": "#bracedElementDef" | ||
}, | ||
{ | ||
"include": "#identifier" | ||
}, | ||
{ | ||
"include": "#operator" | ||
}, | ||
{ | ||
"match": ",", | ||
"name": "punctuation.separator.object.cds" | ||
} | ||
] | ||
}, | ||
"extendElement": { | ||
"name": "extendElement", | ||
"begin": "\\b(?=extend\\b.*\\bwith\\b)", | ||
"begin": "(?:^|\\G)\\s*(?=extend)", | ||
"end": "(?<=[};])(;)?|(;)", | ||
@@ -769,3 +816,3 @@ "endCaptures": { | ||
{ | ||
"begin": "\\bextend\\b", | ||
"begin": "\\bextend\\b(?=.*(?:[@{]|\\bwith\\b))", | ||
"beginCaptures": { | ||
@@ -776,5 +823,5 @@ "0": { | ||
}, | ||
"end": "\\bwith\\b", | ||
"end": "(?:(?=[@{])|\\b(with)\\b)", | ||
"endCaptures": { | ||
"0": { | ||
"1": { | ||
"name": "keyword.cds" | ||
@@ -785,3 +832,3 @@ } | ||
{ | ||
"match": "element(?!(?:\\s*/\\*.*\\*/\\s*|\\s+)?with\\b)", | ||
"match": "element(?!(?:\\s*/[*].*[*]/\\s*|\\s+)?with\\b)", | ||
"name": "keyword.cds" | ||
@@ -1005,3 +1052,3 @@ }, | ||
"1": { | ||
"name": "keyword.operator.colon" | ||
"name": "keyword.operator.cds" | ||
}, | ||
@@ -1062,3 +1109,3 @@ "2": { | ||
"1": { | ||
"name": "keyword.operator.colon" | ||
"name": "keyword.operator.cds" | ||
}, | ||
@@ -1122,3 +1169,3 @@ "2": { | ||
"1": { | ||
"name": "keyword.operator.colon" | ||
"name": "keyword.operator.cds" | ||
} | ||
@@ -1141,3 +1188,3 @@ }, | ||
"1": { | ||
"name": "keyword.operator.colon" | ||
"name": "keyword.operator.cds" | ||
} | ||
@@ -1159,3 +1206,3 @@ }, | ||
"1": { | ||
"name": "keyword.operator.colon" | ||
"name": "keyword.operator.cds" | ||
}, | ||
@@ -1195,3 +1242,3 @@ "2": { | ||
"1": { | ||
"name": "keyword.operator.colon" | ||
"name": "keyword.operator.cds" | ||
} | ||
@@ -1213,3 +1260,3 @@ }, | ||
"1": { | ||
"name": "keyword.operator.colon" | ||
"name": "keyword.operator.cds" | ||
}, | ||
@@ -1234,3 +1281,3 @@ "2": { | ||
"1": { | ||
"name": "keyword.operator.colon" | ||
"name": "keyword.operator.cds" | ||
}, | ||
@@ -1592,2 +1639,75 @@ "2": { | ||
}, | ||
"actionOrFunctionDef": { | ||
"name": "actionOrFunctionDef", | ||
"begin": "(?i)\\b(action|function)\\s+(\"[^\"]*(?:\"\"[^\"]*)*\"|!\\[[^\\]]*(?:\\]\\][^\\]]*)*\\]|[$_\\p{ID_Start}][$\\p{ID_Continue}\\u200C\\u200D]*)", | ||
"beginCaptures": { | ||
"1": { | ||
"name": "keyword.strong.cds" | ||
}, | ||
"2": { | ||
"name": "entity.name.function.cds" | ||
} | ||
}, | ||
"end": ";", | ||
"endCaptures": { | ||
"0": { | ||
"name": "punctuation.terminator.statement.cds" | ||
} | ||
}, | ||
"patterns": [ | ||
{ | ||
"include": "#parameterListDef" | ||
}, | ||
{ | ||
"include": "#comment" | ||
}, | ||
{ | ||
"include": "#atAnnoParen" | ||
}, | ||
{ | ||
"include": "#atAnnoNoParen" | ||
}, | ||
{ | ||
"include": "#keyword" | ||
}, | ||
{ | ||
"include": "#bracedElementDef" | ||
}, | ||
{ | ||
"include": "#identifier" | ||
} | ||
] | ||
}, | ||
"serviceDef": { | ||
"name": "serviceDef", | ||
"begin": "\\b(service)(?=\\s+.*\\S+.*[{;])\\b", | ||
"beginCaptures": { | ||
"1": { | ||
"name": "keyword.strong.cds" | ||
} | ||
}, | ||
"end": "(?<=[};])(;)?|(;)", | ||
"endCaptures": { | ||
"1": { | ||
"name": "punctuation.terminator.statement.cds" | ||
}, | ||
"2": { | ||
"name": "punctuation.terminator.statement.cds" | ||
} | ||
}, | ||
"patterns": [ | ||
{ | ||
"include": "#atAnnoParen" | ||
}, | ||
{ | ||
"include": "#atAnnoNoParen" | ||
}, | ||
{ | ||
"include": "#bracedArtifactDefOrExtend" | ||
}, | ||
{ | ||
"include": "#identifier" | ||
} | ||
] | ||
}, | ||
"asSelectOrProjection": { | ||
@@ -1594,0 +1714,0 @@ "name": "asSelectOrProjection", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
1652336
8888
14
+ Added@sap/cds-compiler@5.4.4(transitive)
+ Addedmarked@14.1.3(transitive)
- Removed@sap/cds-compiler@5.3.2(transitive)
- Removedmarked@14.1.0(transitive)
Updated@sap/cds-compiler@5.4.x
Updatedmarked@14.1.3