@sap/cds-lsp
Advanced tools
Comparing version 7.6.1 to 7.8.0
@@ -10,2 +10,13 @@ # Changelog | ||
## 7.8.0 - 2024-03-25 | ||
### Changed | ||
- formatting logging now includes whitespace even if it may be reduced to empty string, relative alignment positions, and details on inserting delayed items | ||
### Fixed | ||
- code completion for annotations with `![]` identifiers | ||
### Also see | ||
- `@sap/cds-compiler` 4.8.0 | ||
## 7.6.1 - 2024-02-26 | ||
@@ -34,3 +45,3 @@ | ||
- wrong diagnostics about unused imports | ||
- first code completion could have been slow as workspace was scanned unnessarily | ||
- first code completion could have been slow as workspace was scanned unnecessarily | ||
- code completion for annotations was not shown in certain cases | ||
@@ -37,0 +48,0 @@ - `untitled` i.e. new not yet saved files no longer worked in VSCode |
import * as LSP from 'vscode-languageserver-protocol'; | ||
export type Uri = string; | ||
export type AbsolutePath = string; | ||
export type WorkspaceRelativePath = string; | ||
export type FileContent = string; | ||
export type Markdown = string; | ||
export type UsingPath = string; | ||
export type SpecificString<T> = string & { | ||
_brand: T; | ||
}; | ||
export type FileUri = `file:///${string}`; | ||
export type UntitledUri = `untitled:${string}`; | ||
export type Uri = FileUri | UntitledUri; | ||
export type AbsolutePath = `/${string}`; | ||
export type RelativePath = `./${string}` | `../${string}`; | ||
export type FileContent = SpecificString<"FileContent">; | ||
export type Markdown = SpecificString<"Markdown">; | ||
export type WorkspaceRelativePath = SpecificString<"WorkspaceRelativePath">; | ||
export declare const EMPTY_FILE_CONTENT: FileContent; | ||
export type UsingPath = SpecificString<"UsingPath">; | ||
export declare function path_isAbsolute(p: string): p is AbsolutePath; | ||
export declare function path_dirname(p: AbsolutePath): `/${string}`; | ||
export declare function path_resolve(...paths: string[]): `/${string}`; | ||
export declare function path_relative(from: AbsolutePath, to: AbsolutePath): RelativePath; | ||
export declare function path_normalize<T extends AbsolutePath | RelativePath>(p: T): T; | ||
export declare function process_cwd(): `/${string}`; | ||
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"; | ||
@@ -53,3 +66,3 @@ export interface Thing { | ||
location: XsnLocation; | ||
val: string; | ||
val: UsingPath; | ||
}>; | ||
@@ -102,7 +115,7 @@ options: CdsvParseOptions; | ||
export interface ModuleOrigin { | ||
__loadedFrom: string; | ||
__loadedFrom: AbsolutePath; | ||
__logicalLocation: string; | ||
} | ||
export interface ICdsCompiler extends ModuleOrigin { | ||
parse(source: FileContent, filename: AbsolutePath, options?: CdsvParseOptions): XsnParseModel; | ||
parse(source: FileContent, filename: string, options?: CdsvParseOptions): XsnParseModel; | ||
compile(fileNames: AbsolutePath[], dir?: AbsolutePath, options?: CdsvCompileOptions, map?: CdsvSourceDictionary): Promise<XsnCompileModel>; | ||
@@ -284,3 +297,3 @@ version(): string; | ||
location: XsnLocation; | ||
realname?: string; | ||
realname?: AbsolutePath; | ||
val: string; | ||
@@ -472,3 +485,3 @@ } | ||
idTokens: IIdentifierToken[]; | ||
directDependentUris: string[]; | ||
directDependentUris: FileUri[]; | ||
readonly annotationAssignments: IterableIterator<IAnnotationAssignmentToken>; | ||
@@ -500,3 +513,3 @@ } | ||
export interface Translation { | ||
uri: string; | ||
uri: FileUri; | ||
line: number; | ||
@@ -503,0 +516,0 @@ character: number; |
@@ -7,8 +7,13 @@ import { BigIntStats, Dirent, PathLike, StatOptions, Stats, WriteFileOptions } from 'node:fs'; | ||
export declare const lspRoot: string; | ||
export type Uri = string; | ||
export type AbsolutePath = string; | ||
export type WorkspaceRelativePath = string; | ||
export type FileContent = string; | ||
export type UsingPath = string; | ||
export declare const lspRoot: `/${string}`; | ||
export type SpecificString<T> = string & { | ||
_brand: T; | ||
}; | ||
export type FileUri = `file:///${string}`; | ||
export type UntitledUri = `untitled:${string}`; | ||
export type Uri = FileUri | UntitledUri; | ||
export type AbsolutePath = `/${string}`; | ||
export type FileContent = SpecificString<"FileContent">; | ||
export type WorkspaceRelativePath = SpecificString<"WorkspaceRelativePath">; | ||
export type UsingPath = SpecificString<"UsingPath">; | ||
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"; | ||
@@ -58,3 +63,3 @@ export interface Thing { | ||
location: XsnLocation; | ||
val: string; | ||
val: UsingPath; | ||
}>; | ||
@@ -107,7 +112,7 @@ options: CdsvParseOptions; | ||
export interface ModuleOrigin { | ||
__loadedFrom: string; | ||
__loadedFrom: AbsolutePath; | ||
__logicalLocation: string; | ||
} | ||
export interface ICdsCompiler extends ModuleOrigin { | ||
parse(source: FileContent, filename: AbsolutePath, options?: CdsvParseOptions): XsnParseModel; | ||
parse(source: FileContent, filename: string, options?: CdsvParseOptions): XsnParseModel; | ||
compile(fileNames: AbsolutePath[], dir?: AbsolutePath, options?: CdsvCompileOptions, map?: CdsvSourceDictionary): Promise<XsnCompileModel>; | ||
@@ -261,3 +266,3 @@ version(): string; | ||
location: XsnLocation; | ||
realname?: string; | ||
realname?: AbsolutePath; | ||
val: string; | ||
@@ -436,3 +441,3 @@ } | ||
idTokens: IIdentifierToken[]; | ||
directDependentUris: string[]; | ||
directDependentUris: FileUri[]; | ||
readonly annotationAssignments: IterableIterator<IAnnotationAssignmentToken>; | ||
@@ -464,3 +469,3 @@ } | ||
export interface Translation { | ||
uri: string; | ||
uri: FileUri; | ||
line: number; | ||
@@ -603,3 +608,5 @@ character: number; | ||
"condition", | ||
"conditionTerm", | ||
"conditionCont", | ||
"conditionOrQueryParenthesis", | ||
"conditionPrimary", | ||
"contextDef", | ||
@@ -612,2 +619,3 @@ "elementDef", | ||
"expression", | ||
"expressionPrimary", | ||
"extendArtifact", | ||
@@ -629,3 +637,3 @@ "extendContext", | ||
"queryTerm", | ||
"queryPrimary", | ||
"selectQuery", | ||
"returnTypeSpec", | ||
@@ -662,3 +670,6 @@ "selectItemDef", | ||
"Entity", | ||
"Extend", | ||
"Ext", | ||
"ExtContext", | ||
"ExtElement", | ||
"ExtService", | ||
"Element", | ||
@@ -669,6 +680,11 @@ "Action", | ||
"paramname", | ||
"typeparamname", | ||
"Event", | ||
"AnnoDef", | ||
"Annotate", | ||
"ExtBoundAction", | ||
"ExtParam", | ||
"anno", | ||
"annoref", | ||
"uncheckedRef", | ||
"uncheckedAnno", | ||
"name", | ||
@@ -681,2 +697,3 @@ "variant", | ||
"FromAlias", | ||
"UsingAlias", | ||
"Item", | ||
@@ -736,2 +753,3 @@ "Mixin", | ||
parent: IRuleNode; | ||
reducedAncestors: BlockRule[]; | ||
getNextToken(predicate?: (token: IRuleToken) => boolean): IRuleToken | undefined; | ||
@@ -755,2 +773,3 @@ getPreviousToken(predicate?: (token: IRuleToken) => boolean): IRuleToken | undefined; | ||
parent?: IRuleNode; | ||
reducedAncestors: BlockRule[]; | ||
children: IRuleItem[]; | ||
@@ -762,3 +781,3 @@ readonly startTokenIndex: number; | ||
readonly context: ITokenContext; | ||
readonly data: Record<string, unknown>; | ||
data?: Record<string, unknown>; | ||
getFirstToken(predicate?: (child: IRuleToken) => boolean, subtreePredicate?: (child: IRuleNode) => boolean): IRuleToken | undefined; | ||
@@ -831,3 +850,3 @@ getLastToken(predicate?: (child: IRuleToken) => boolean, subtreePredicate?: (child: IRuleNode) => boolean): IRuleToken | undefined; | ||
name?: string; | ||
folder?: string; | ||
folder?: AbsolutePath; | ||
} | ||
@@ -846,3 +865,3 @@ export interface ITrace { | ||
export type TraceLevel = "off" | "error" | "warning" | "info" | "verbose" | "debug"; | ||
export type WorkspaceRelativeUri = string; | ||
export type WorkspaceRelativeUri = SpecificString<"WorkspaceRelativeUri">; | ||
export interface IStatistics { | ||
@@ -893,3 +912,3 @@ modelFiles: number; | ||
compile(localPath: AbsolutePath, workspaceRoot: AbsolutePath, files: CdsvSourceDictionary, options?: CdsvCompileOptions, cacheHandler?: ICacheHandler): Promise<XsnCompileModel>; | ||
parse(content: FileContent, localPath: AbsolutePath, dataTemplate?: Record<string, unknown>): { | ||
parse(content: FileContent, localPath: string): { | ||
rootNode: IRuleNode; | ||
@@ -928,8 +947,8 @@ parseAst: XsnParseModel; | ||
loadCds(projectRoot: AbsolutePath): Cds; | ||
getProjectCdsHome(projectRoot: AbsolutePath): string | undefined; | ||
getGlobalCdsHome(): any; | ||
getProjectCdsHome(projectRoot: AbsolutePath): AbsolutePath | undefined; | ||
getGlobalCdsHome(): AbsolutePath; | ||
} | ||
export interface _IPathAdapter { | ||
readonly rootUri: Uri; | ||
readonly localRootPath: string; | ||
readonly localRootPath: AbsolutePath; | ||
toUri(absolutePath: AbsolutePath): Uri; | ||
@@ -969,3 +988,3 @@ toLocalPath(uri: Uri): AbsolutePath; | ||
folders: { | ||
[kind in typeof extendedLayers[number]]?: WorkspaceRelativePath; | ||
[kind in typeof extendedLayers[number]]?: WorkspaceRelativeUri; | ||
}; | ||
@@ -1054,5 +1073,3 @@ i18n: I18n; | ||
} | ||
export interface WorkspaceDocumentsWithPossibleDeletions { | ||
[uri: Uri]: FileContent | T_FILE_DOES_NOT_EXIST; | ||
} | ||
export type IWorkspaceDocumentsWithPossibleDeletions = Map<Uri, FileContent | T_FILE_DOES_NOT_EXIST>; | ||
declare enum WorkspaceValidationMode { | ||
@@ -1083,3 +1100,3 @@ ActiveEditorOnly = "ActiveEditorOnly", | ||
getContent(uri: Uri): FileContent | T_FILE_DOES_NOT_EXIST; | ||
change(changedDiskDocs?: WorkspaceDocumentsWithPossibleDeletions, changedOpenDocs?: WorkspaceDocumentsWithPossibleDeletions, clone?: boolean): _IWorkspaceSnapshot; | ||
change(changedDiskDocs?: IWorkspaceDocumentsWithPossibleDeletions, changedOpenDocs?: IWorkspaceDocumentsWithPossibleDeletions, clone?: boolean): _IWorkspaceSnapshot; | ||
adapter: _IPathAdapter; | ||
@@ -1117,4 +1134,4 @@ reset(): _IWorkspaceSnapshot; | ||
onTranslationFileChanged(translationFileUri: Uri, content: FileContent | T_FILE_DOES_NOT_EXIST): void; | ||
getMostRelevantTranslationFileUri(forSourceUri: Uri): Uri | undefined; | ||
getTranslationIndex(translationFileUri: Uri): _II18nIndex; | ||
getMostRelevantTranslationFileUri(forSourceUri: Uri): FileUri | undefined; | ||
getTranslationIndex(translationFileUri: FileUri): _II18nIndex; | ||
resetTranslations(): void; | ||
@@ -1126,3 +1143,3 @@ } | ||
content: FileContent; | ||
readonly uri: Uri; | ||
readonly uri: FileUri; | ||
readonly entries: IterableIterator<Translation>; | ||
@@ -1172,7 +1189,7 @@ index(cdsEnv: Env, content: FileContent): void; | ||
ensureScanned(): Promise<void>; | ||
progressSnapshot(changedDiskDocuments?: WorkspaceDocumentsWithPossibleDeletions, changedOpenDocuments?: WorkspaceDocumentsWithPossibleDeletions, updateCurrentRequestSnapshot?: boolean): IWorkspaceUpdated; | ||
progressSnapshot(changedDiskDocuments?: IWorkspaceDocumentsWithPossibleDeletions, changedOpenDocuments?: IWorkspaceDocumentsWithPossibleDeletions, updateCurrentRequestSnapshot?: boolean): IWorkspaceUpdated; | ||
readContent(uri: Uri): FileContent | T_FILE_DOES_NOT_EXIST; | ||
} | ||
export interface _IUsingPathResolver { | ||
resolveUsingPath(triggerUri: Uri, importPath: UsingPath, workspaceFolder: _IWorkspaceFolder): Uri | undefined; | ||
resolveUsingPath(triggerUri: Uri, importPath: UsingPath, workspaceFolder: _IWorkspaceFolder): FileUri | undefined; | ||
} | ||
@@ -1363,3 +1380,3 @@ export interface WorkspaceServiceEvents { | ||
isCsnFile(uriOrFilepath: Uri | AbsolutePath, getContent: () => FileContent | T_FILE_DOES_NOT_EXIST): boolean; | ||
isCdsEnvFile(uri: Uri): boolean; | ||
isCdsEnvFile(uri: Uri | AbsolutePath): boolean; | ||
isIgnoreFile(uriOrFilepath: Uri | AbsolutePath): boolean; | ||
@@ -1558,3 +1575,3 @@ isCdsSourceFile(uriOrFilepath: Uri | AbsolutePath): boolean; | ||
readonly description: string; | ||
readonly sampleCode: string; | ||
readonly sampleCode: FileContent; | ||
readonly parentDependency?: FormatOptionName; | ||
@@ -1591,4 +1608,4 @@ readonly isInternal: boolean; | ||
command: "config"; | ||
sourcePath: Uri; | ||
projectPath: Uri; | ||
sourcePath: AbsolutePath; | ||
projectPath: AbsolutePath; | ||
} | ||
@@ -1598,5 +1615,5 @@ export interface CdsLspPropertiesParams { | ||
} | ||
export declare function formatCli(args?: string[], cwd?: string): Promise<void>; | ||
export declare function formatCli(args?: string[], cwd?: `/${string}`): Promise<void>; | ||
export declare function ruleName(child: IRuleItem): BlockRule | undefined; | ||
export {}; |
{ | ||
"name": "@sap/cds-lsp", | ||
"description": "Language server for CDS", | ||
"version": "7.6.1", | ||
"version": "7.8.0", | ||
"homepage": "https://cap.cloud.sap/", | ||
@@ -38,6 +38,6 @@ "author": "SAP SE (https://www.sap.com)", | ||
"dependencies": { | ||
"@sap/cds-compiler": "4.6.2", | ||
"@sap/cds-compiler": "4.8.0", | ||
"ignore": "5.3.1", | ||
"json-source-map": "0.6.1", | ||
"marked": "12.0.0", | ||
"marked": "12.0.1", | ||
"tiny-typed-emitter": "2.1.0", | ||
@@ -44,0 +44,0 @@ "vscode-languageserver": "9.0.1", |
@@ -347,3 +347,3 @@ { | ||
"comment": "Types (exact casing)", | ||
"match": "(?<!\\.|\\$)\\b(Binary|Boolean|DateTime|Date|DecimalFloat|Decimal|Double|Int(16|32|64)|Integer64|Integer|LargeBinary|LargeString|Number|String|Timestamp|Time|UInt8|UUID)\\b\\s*(\\([^()]*\\))?(?!\\$|\\s*:)", | ||
"match": "(?<!\\.|\\$)\\b(Binary|Boolean|DateTime|Date|DecimalFloat|Decimal|Double|Int(16|32|64)|Integer64|Integer|LargeBinary|LargeString|Number|String|Timestamp|Time|UInt8|UUID|Vector)\\b\\s*(\\([^()]*\\))?(?!\\$|\\s*:)", | ||
"name": "support.class.cds" | ||
@@ -350,0 +350,0 @@ }, |
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
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
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
1608656
8467
+ Added@sap/cds-compiler@4.8.0(transitive)
+ Addedmarked@12.0.1(transitive)
- Removed@sap/cds-compiler@4.6.2(transitive)
- Removedmarked@12.0.0(transitive)
Updated@sap/cds-compiler@4.8.0
Updatedmarked@12.0.1