@sap/cds-lsp
Advanced tools
Comparing version 7.5.0 to 7.6.0
@@ -9,2 +9,28 @@ # Changelog | ||
## 7.6.0 - tbd | ||
### Added | ||
- `format-cds` CLI now supports `--check` which tests given CDS sources if formatted according settings and fails otherwise (for CI/CD). | ||
For some erroneous CDS sources which cannot be formatted the exit code is `2`. | ||
- hover over import path of `using` statement shows `README.md` or `package.json#description` if absolute (i.e. module) import | ||
### Changed | ||
- formatting option `alignAfterKey` option now applies to views and projections as well | ||
- supportability: snapshot versions are now shown in log already with `verbose` level | ||
- cds-lsp is now using `es2022` | ||
### Fixed | ||
- removed padding after unary plus, minus or parameter colon | ||
- artifact-elements snippet in `annotate` statement now appears regardless of cursor position between braces (or logs reason for not appearing) | ||
- highlighting after semicolon in certain contexts | ||
- on Windows editor potentially no longer updated diagnostics for sources with annotations | ||
- wrong diagnostics about unused imports | ||
- first code completion could have been slow as workspace was scanned unnessarily | ||
- code completion for annotations was not shown in certain cases | ||
- `untitled` i.e. new not yet saved files no longer worked in VSCode | ||
### Also see | ||
- `@sap/cds-compiler` 4.6.2 | ||
## 7.5.0 - 2023-12-20 | ||
@@ -11,0 +37,0 @@ |
@@ -1,3 +0,1 @@ | ||
import * as LSP from 'vscode-languageserver-protocol'; | ||
@@ -9,2 +7,3 @@ | ||
export type FileContent = string; | ||
export type Markdown = string; | ||
export type UsingPath = string; | ||
@@ -440,2 +439,3 @@ export type Kind = "context" | "service" | "namespace" | "entity" | "event" | "view" | "type" | "annotation" | "annotate" | "action" | "function" | "const" | "role" | "aspect" | "accesspolicy" | "mixin" | "element" | "query" | "param" | "enum" | "source" | "using" | "extend" | "qualifiedAnnotation"; | ||
isIdentifier(): boolean; | ||
isKeyword(): boolean; | ||
compare(position: LSP.Position): number; | ||
@@ -447,2 +447,10 @@ } | ||
} | ||
export interface ITranslationStringToken extends IStringLiteralToken { | ||
translationId: string; | ||
} | ||
export declare function isTranslationStringToken(token: IStringLiteralToken): token is ITranslationStringToken; | ||
export interface IImportPathStringToken extends IStringLiteralToken { | ||
isUsingPath: true; | ||
} | ||
export declare function isImportPathStringToken(token: IStringLiteralToken): token is IImportPathStringToken; | ||
export interface IGenericDefinition { | ||
@@ -516,4 +524,4 @@ readonly symbolName: FullyQualifiedName; | ||
fetchHover?: (params: CdsHoverParams) => Promise<CdsHover | undefined>; | ||
fetchDefinition?: (params: CdsDefinitionParams) => Promise<LSP.Location | LSP.Location[] | undefined>; | ||
fetchReferences?: (params: CdsDefinitionParams) => Promise<LSP.Location[]>; | ||
fetchDefinition?: (params: CdsDefinitionParams) => Promise<CdsLocation | CdsLocation[] | undefined>; | ||
fetchReferences?: (params: CdsDefinitionParams) => Promise<CdsLocation[]>; | ||
fetchSemanticTokens?: (params: CdsSemanticTokensParams) => Promise<SemanticToken[]>; | ||
@@ -523,2 +531,5 @@ indexAnnotationIdentifiers?: (params: CdsIndexingParams) => Promise<CdsAnnotationIndex>; | ||
} | ||
export interface CdsLocation extends LSP.Location { | ||
uri: Uri; | ||
} | ||
export interface CdsIndexingParams { | ||
@@ -525,0 +536,0 @@ uris: Uri[]; |
@@ -1,4 +0,2 @@ | ||
import { BigIntStats, Dirent, PathLike, StatOptions, Stats, WriteFileOptions } from 'fs'; | ||
import { BigIntStats, Dirent, PathLike, StatOptions, Stats, WriteFileOptions } from 'node:fs'; | ||
import { TypedEmitter } from 'tiny-typed-emitter'; | ||
@@ -411,2 +409,3 @@ import * as LS from 'vscode-languageserver'; | ||
isIdentifier(): boolean; | ||
isKeyword(): boolean; | ||
compare(position: LSP.Position): number; | ||
@@ -486,4 +485,4 @@ } | ||
fetchHover?: (params: CdsHoverParams) => Promise<CdsHover | undefined>; | ||
fetchDefinition?: (params: CdsDefinitionParams) => Promise<LSP.Location | LSP.Location[] | undefined>; | ||
fetchReferences?: (params: CdsDefinitionParams) => Promise<LSP.Location[]>; | ||
fetchDefinition?: (params: CdsDefinitionParams) => Promise<CdsLocation | CdsLocation[] | undefined>; | ||
fetchReferences?: (params: CdsDefinitionParams) => Promise<CdsLocation[]>; | ||
fetchSemanticTokens?: (params: CdsSemanticTokensParams) => Promise<SemanticToken[]>; | ||
@@ -493,2 +492,5 @@ indexAnnotationIdentifiers?: (params: CdsIndexingParams) => Promise<CdsAnnotationIndex>; | ||
} | ||
export interface CdsLocation extends LSP.Location { | ||
uri: Uri; | ||
} | ||
export interface CdsIndexingParams { | ||
@@ -579,2 +581,3 @@ uris: Uri[]; | ||
"actionFunctionMainDef", | ||
"annotateArtifact", | ||
"annotateArtifactElements", | ||
@@ -639,2 +642,36 @@ "annotateElement", | ||
export type TokenCategory = "Identifier" | "Keyword" | "Operator" | "String" | "number" | "Number" | "Comment" | "LineComment" | "DocComment" | "<EOF>" | "<???>"; | ||
declare const IdentifierCategories: readonly [ | ||
"<n/a>", | ||
"Namespace", | ||
"Using", | ||
"global", | ||
"Context", | ||
"Service", | ||
"Type", | ||
"Enum", | ||
"Entity", | ||
"Extend", | ||
"Element", | ||
"Action", | ||
"BoundAction", | ||
"Param", | ||
"paramname", | ||
"Event", | ||
"AnnoDef", | ||
"Annotate", | ||
"anno", | ||
"name", | ||
"variant", | ||
"ref", | ||
"artref", | ||
"enumref", | ||
"paramref", | ||
"FromAlias", | ||
"Item", | ||
"Mixin", | ||
"Key", | ||
"Without", | ||
"func" | ||
]; | ||
export type IdentifierCategory = typeof IdentifierCategories[number]; | ||
export type RelativeToCursor = "tokenAfterCursor" | "tokenStartsAtCursor" | "tokenContainsCursor" | "tokenEndsWithCursor" | "tokenBeforeCursor"; | ||
@@ -656,5 +693,5 @@ export interface IToken extends LSP.Range, LSP.Position { | ||
ejected: boolean; | ||
data: unknown; | ||
id: string; | ||
isIdentifier(): boolean; | ||
isIdentifier(): this is IBaseIdentifierToken; | ||
isStringLiteral(): this is IBaseStringLiteralToken; | ||
isOperator(): boolean; | ||
@@ -671,2 +708,13 @@ isKeyword(): boolean; | ||
} | ||
export interface IBaseStringLiteralToken extends IToken { | ||
translationId?: string; | ||
isUsingPath?: boolean; | ||
} | ||
export interface IBaseIdentifierToken extends IToken { | ||
readonly category: "Identifier"; | ||
identifierCategory: IdentifierCategory; | ||
localName?: string; | ||
absoluteName: FullyQualifiedName; | ||
isLastPathSegment: boolean; | ||
} | ||
export interface IRuleToken extends IToken { | ||
@@ -868,3 +916,3 @@ id: string; | ||
export interface _IPathAdapter { | ||
readonly clientRootUri: Uri; | ||
readonly rootUri: Uri; | ||
readonly localRootPath: string; | ||
@@ -885,3 +933,3 @@ toUri(absolutePath: AbsolutePath): Uri; | ||
} | ||
export interface IInternalAnnotationContribution extends IAnnotationContribution { | ||
export interface IInternalAnnotationContribution extends Required<IAnnotationContribution> { | ||
name: string; | ||
@@ -1041,3 +1089,3 @@ version: string; | ||
export type AnnotationNamesForDocumentation = typeof annotationNamesForDocumentation[number]; | ||
export type Domain = AnnotationNamesForDocumentation | "translation" | "annotation domain" | "documentation"; | ||
export type Domain = AnnotationNamesForDocumentation | "translation" | "annotation domain" | "documentation" | "imports"; | ||
export interface _IDocumentation { | ||
@@ -1073,10 +1121,10 @@ domain: Domain; | ||
readonly dependencies: { | ||
readonly [name: string]: AbsolutePath; | ||
readonly [name: string]: AbsolutePath | undefined; | ||
}; | ||
readonly devDependencies: { | ||
readonly [name: string]: AbsolutePath; | ||
readonly [name: string]: AbsolutePath | undefined; | ||
}; | ||
} | ||
export interface INpmPackages { | ||
getPackageRootFolder(filePath: AbsolutePath): INpmPackageMeta; | ||
getPackageRootFolder(filePath: AbsolutePath): INpmPackageMeta | undefined; | ||
} | ||
@@ -1099,6 +1147,6 @@ export interface _IWorkspaceFolder { | ||
getCdsEnv(): Env; | ||
fetchTransitiveIndex(uri: Uri, context?: IIndexContext): Promise<IBlitzIndex>; | ||
fetchTransitiveIndex(uri: Uri, context?: IIndexContext): Promise<IBlitzIndex | undefined>; | ||
fetchFileIndex(uri: Uri, context?: IIndexContext): Promise<_IFileIndex>; | ||
fetchToken(uri: Uri, position: LSP.Position, fetchAnnotationToken?: false | undefined): Promise<IIdentifierToken | IStringLiteralToken>; | ||
fetchToken(uri: Uri, position: LSP.Position, fetchAnnotationToken: true): Promise<IAnnotationAssignmentToken>; | ||
fetchToken(uri: Uri, position: LSP.Position, fetchAnnotationToken?: false | undefined): Promise<IIdentifierToken | IStringLiteralToken | undefined>; | ||
fetchToken(uri: Uri, position: LSP.Position, fetchAnnotationToken: true): Promise<IAnnotationAssignmentToken | undefined>; | ||
fetchAst(uri: Uri, snapshot?: _IWorkspaceSnapshot): Promise<XsnCompileModel>; | ||
@@ -1111,3 +1159,3 @@ getContent(uri: Uri): FileContent | T_FILE_DOES_NOT_EXIST; | ||
export interface _IUsingPathResolver { | ||
resolveUsingPath(triggerUri: Uri, importPath: string, workspaceFolder: _IWorkspaceFolder): Uri | undefined; | ||
resolveUsingPath(triggerUri: Uri, importPath: UsingPath, workspaceFolder: _IWorkspaceFolder): Uri | undefined; | ||
} | ||
@@ -1170,3 +1218,3 @@ export interface WorkspaceServiceEvents { | ||
export interface IActiveEditorChangedArguments { | ||
previousActiveUri: Uri; | ||
previousActiveUri: Uri | undefined; | ||
newActiveUri: Uri; | ||
@@ -1235,3 +1283,3 @@ } | ||
export interface _IDocumentationProvider { | ||
fetchTokenDocumentation(genericToken: IGenericToken, snapshot: _IWorkspaceSnapshot): IterableIterator<_IDocumentation>; | ||
streamTokenDocumentation(genericToken: IGenericToken, snapshot: _IWorkspaceSnapshot): IterableIterator<_IDocumentation>; | ||
streamDefinitionDocumentations(sourceUri: Uri, definitions: IGenericDefinition[]): IterableIterator<_IDocumentation>; | ||
@@ -1238,0 +1286,0 @@ } |
@@ -30,3 +30,3 @@ ## Code Formatting | ||
|--------------------------------------|---------------|------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------| | ||
| alignAfterKey | true | Align _element identifiers_ after optional `key` keyword | | | ||
| alignAfterKey | true | Align _element identifiers_ and `select` items after optional `key` keyword | | | ||
| alignAnnotations | true | Align _annotations_ | | | ||
@@ -33,0 +33,0 @@ | alignPreAnnotations | true | Align annotations before items. If multiple annotations exist in a line, they are aligned in a tabular way | alignAnnotations | |
{ | ||
"name": "@sap/cds-lsp", | ||
"description": "Language server for CDS", | ||
"version": "7.5.0", | ||
"version": "7.6.0", | ||
"homepage": "https://cap.cloud.sap/", | ||
@@ -26,3 +26,2 @@ "author": "SAP SE (https://www.sap.com)", | ||
"README.md", | ||
"npm-shrinkwrap.json", | ||
"LICENSE" | ||
@@ -40,6 +39,6 @@ ], | ||
"dependencies": { | ||
"@sap/cds-compiler": "4.5.0", | ||
"ignore": "5.3.0", | ||
"@sap/cds-compiler": "4.6.2", | ||
"ignore": "5.3.1", | ||
"json-source-map": "0.6.1", | ||
"marked": "11.1.0", | ||
"marked": "12.0.0", | ||
"tiny-typed-emitter": "2.1.0", | ||
@@ -46,0 +45,0 @@ "vscode-languageserver": "9.0.1", |
@@ -748,3 +748,3 @@ { | ||
"begin": "\\b(?=extend\\b.*\\bwith\\b)", | ||
"end": "(?<=})(;)?|(;)", | ||
"end": "(?<=[};])(;)?|(;)", | ||
"endCaptures": { | ||
@@ -1311,3 +1311,3 @@ "1": { | ||
}, | ||
"end": "(?<=})(;)?|(;)", | ||
"end": "(?<=[};])(;)?|(;)", | ||
"endCaptures": { | ||
@@ -1364,3 +1364,3 @@ "1": { | ||
}, | ||
"end": "(?<=})(;)?|(;)", | ||
"end": "(?<=[};])(;)?|(;)", | ||
"endCaptures": { | ||
@@ -1400,3 +1400,3 @@ "1": { | ||
}, | ||
"end": "(?<=})(;)?|(;)", | ||
"end": "(?<=[};])(;)?|(;)", | ||
"endCaptures": { | ||
@@ -1470,3 +1470,3 @@ "1": { | ||
}, | ||
"end": "(?<=})(;)?|(;)", | ||
"end": "(?<=[};])(;)?|(;)", | ||
"endCaptures": { | ||
@@ -1473,0 +1473,0 @@ "1": { |
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
Sorry, the diff of this file is too big to display
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
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
NPM Shrinkwrap
Supply chain riskPackage contains a shrinkwrap file. This may allow the package to bypass normal install procedures.
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
1606326
8439
0
29
+ Added@sap/cds-compiler@4.6.2(transitive)
+ Addedignore@5.3.1(transitive)
+ Addedmarked@12.0.0(transitive)
- Removed@sap/cds-compiler@4.5.0(transitive)
- Removedignore@5.3.0(transitive)
- Removedmarked@11.1.0(transitive)
Updated@sap/cds-compiler@4.6.2
Updatedignore@5.3.1
Updatedmarked@12.0.0