@likec4/language-server 1.59.0 → 1.59.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/module.mjs +16 -7
- package/dist/chunks/utils.mjs +1 -1
- package/package.json +8 -8
package/dist/chunks/module.mjs
CHANGED
|
@@ -6,7 +6,7 @@ import { BuildDocuments, ChangeView, DidChangeModelNotification, DidChangeProjec
|
|
|
6
6
|
import { DefaultMap, DefaultWeakMap, MultiMap, ancestorsFqn, compareNatural, compareNaturalHierarchically, ifilter, invariant, isNonEmptyArray, isString, nameFromFqn, nonNullable, nonexhaustive, onNextTick, parentFqn, sortNaturalByFqn, sortParentsFirst, stringHash, toArray } from "@likec4/core/utils";
|
|
7
7
|
import { loggable, wrapError } from "@likec4/log";
|
|
8
8
|
import { AstUtils, Cancellation, ContextCache, CstUtils, DefaultDocumentValidator, DefaultIndexManager, DefaultLangiumDocuments, DefaultNameProvider, DefaultScopeComputation, DefaultScopeProvider, DefaultValueConverter, DefaultWorkspaceManager, Disposable, DocumentState, EMPTY_SCOPE, EMPTY_STREAM, GrammarAST, GrammarUtils, JSDocDocumentationProvider, MapScope, MultiMap as MultiMap$1, StreamScope, TextDocument, URI, UriUtils, ValueConverter, WorkspaceCache, inject, interruptAndCheck, isAstNode, isNamed, isOperationCancelled, stream } from "langium";
|
|
9
|
-
import { cleanDoubleSlashes, hasLeadingSlash, hasProtocol, isRelative, joinRelativeURL, joinURL, withTrailingSlash, withoutBase, withoutLeadingSlash,
|
|
9
|
+
import { cleanDoubleSlashes, hasLeadingSlash, hasProtocol, isRelative, joinRelativeURL, joinURL, withTrailingSlash, withoutBase, withoutLeadingSlash, withoutTrailingSlash } from "ufo";
|
|
10
10
|
import { anyPass, clamp, entries, filter, find, findLast, first, flatMap, forEach, forEachObj, funnel, groupBy, hasAtLeast, identity, indexBy, isArray, isBoolean, isDefined, isEmpty, isEmptyish, isNonNullish, isNot, isNullish, isNumber, isPromise, isString as isString$1, isTruthy, keys, last, map, mapToObj, mapValues, omitBy, once, only, pipe, piped, prop, purry, reduce, sort, unique, uniqueBy, values } from "remeda";
|
|
11
11
|
import * as c4 from "@likec4/core";
|
|
12
12
|
import { DefaultMap as DefaultMap$1, Fqn, FqnExpr, FqnRef, GlobalFqn, LinkedList, RelationExpr, _layout, _stage, _type, ancestorsFqn as ancestorsFqn$1, applyCachedLayout, applyManualLayout, calcDriftsFromSnapshot, exact, invariant as invariant$1, isAncestor, isAndOperator, isAnyOf, isDeploymentNode, isElementView, isGlobalFqn, isNonEmptyArray as isNonEmptyArray$1, isOrOperator, isSameHierarchy, nameFromFqn as nameFromFqn$1, nonNullable as nonNullable$1, nonexhaustive as nonexhaustive$1, preferSummary, splitGlobalFqn } from "@likec4/core";
|
|
@@ -375,6 +375,14 @@ function normalizeUri(uri) {
|
|
|
375
375
|
}
|
|
376
376
|
return uri.toString();
|
|
377
377
|
}
|
|
378
|
+
const windowsDrivePath = /^\/?([A-Za-z]):(?=\/|$)/;
|
|
379
|
+
function normalizeWindowsDrivePath(path) {
|
|
380
|
+
return path.replace(windowsDrivePath, (_, drive) => `/${drive.toLowerCase()}:`);
|
|
381
|
+
}
|
|
382
|
+
function uriPathForMatcher(uri) {
|
|
383
|
+
if (URI.isUri(uri)) return normalizeWindowsDrivePath(uri.path);
|
|
384
|
+
return normalizeWindowsDrivePath(URI.parse(uri).path);
|
|
385
|
+
}
|
|
378
386
|
/**
|
|
379
387
|
* Compare function to ensure consistent order
|
|
380
388
|
*/
|
|
@@ -402,7 +410,7 @@ function _isInScope(project, docUri) {
|
|
|
402
410
|
return docUri.startsWith(project.folder) || (project.includePaths?.some(isParentFolderFor(docUri)) ?? false);
|
|
403
411
|
}
|
|
404
412
|
function _excludes(project, docUri) {
|
|
405
|
-
return project.exclude?.(
|
|
413
|
+
return project.exclude?.(uriPathForMatcher(docUri)) ?? false;
|
|
406
414
|
}
|
|
407
415
|
function includes(...args) {
|
|
408
416
|
return purry(_includes, args);
|
|
@@ -439,7 +447,7 @@ const DefaultProject = {
|
|
|
439
447
|
}
|
|
440
448
|
};
|
|
441
449
|
function isExcludedByDefault(uri) {
|
|
442
|
-
return DefaultProject.exclude(
|
|
450
|
+
return DefaultProject.exclude(uriPathForMatcher(uri));
|
|
443
451
|
}
|
|
444
452
|
/**
|
|
445
453
|
* Parses the given options and returns an object with the following properties:
|
|
@@ -542,7 +550,7 @@ var ProjectsManager = class ProjectsManager extends ADisposable {
|
|
|
542
550
|
isExcludedByWorkspace(uri) {
|
|
543
551
|
if (!this.#workspaceExclude) return false;
|
|
544
552
|
if (URI.isUri(uri)) uri = normalizeUri(uri);
|
|
545
|
-
return this.#workspaceExclude(
|
|
553
|
+
return this.#workspaceExclude(uriPathForMatcher(uri));
|
|
546
554
|
}
|
|
547
555
|
/**
|
|
548
556
|
* Updates the workspace-level exclude patterns from VS Code settings.
|
|
@@ -555,6 +563,7 @@ var ProjectsManager = class ProjectsManager extends ADisposable {
|
|
|
555
563
|
return;
|
|
556
564
|
}
|
|
557
565
|
const normalizedPatterns = pipe(patterns, filter(isTruthy), map((p) => {
|
|
566
|
+
p = normalizeWindowsDrivePath(p);
|
|
558
567
|
if (!isAbsolute(p) && !p.startsWith("**")) p = joinURL("**", p);
|
|
559
568
|
return p;
|
|
560
569
|
}));
|
|
@@ -925,7 +934,7 @@ var ProjectsManager = class ProjectsManager extends ADisposable {
|
|
|
925
934
|
if (isNullish(exclude)) project.exclude = DefaultProject.exclude;
|
|
926
935
|
else if (hasAtLeast(exclude, 1)) project.exclude = picomatch([project.folderUri, ...map(project.includePaths ?? [], prop("uri"))].flatMap((root) => map(exclude, (p) => {
|
|
927
936
|
if (!isRelative(p) && !p.startsWith("**")) p = joinURL("**", p);
|
|
928
|
-
return cleanDoubleSlashes(joinRelativeURL(root
|
|
937
|
+
return cleanDoubleSlashes(joinRelativeURL(uriPathForMatcher(root), p));
|
|
929
938
|
})), {
|
|
930
939
|
contains: true,
|
|
931
940
|
dot: true
|
|
@@ -1050,7 +1059,7 @@ var LikeC4WorkspaceManager = class extends DefaultWorkspaceManager {
|
|
|
1050
1059
|
*/
|
|
1051
1060
|
async scanProjectIncludePaths() {
|
|
1052
1061
|
const includePaths = this.services.workspace.ProjectsManager.getAllIncludePaths();
|
|
1053
|
-
if (hasAtLeast(includePaths, 1)) return [];
|
|
1062
|
+
if (!hasAtLeast(includePaths, 1)) return [];
|
|
1054
1063
|
const isNotExcludedByWorkspace = isNot((f) => this.services.workspace.ProjectsManager.isExcludedByWorkspace(f.uri));
|
|
1055
1064
|
const foundFiles = [];
|
|
1056
1065
|
for (const { projectId, includePath, includeConfig } of includePaths) try {
|
|
@@ -7188,7 +7197,7 @@ var LikeC4ScopeComputation = class extends DefaultScopeComputation {
|
|
|
7188
7197
|
if (isTruthy(spec.tag.name)) docExports.push(this.descriptions.createDescription(spec.tag, spec.tag.name, document), this.descriptions.createDescription(spec.tag, "#" + spec.tag.name, document));
|
|
7189
7198
|
continue;
|
|
7190
7199
|
case isSpecificationRelationshipKind(spec):
|
|
7191
|
-
if (isTruthy(spec.kind.name)) docExports.push(this.descriptions.createDescription(spec.kind, spec.kind.name, document)
|
|
7200
|
+
if (isTruthy(spec.kind.name)) docExports.push(this.descriptions.createDescription(spec.kind, spec.kind.name, document));
|
|
7192
7201
|
continue;
|
|
7193
7202
|
case isSpecificationColor(spec):
|
|
7194
7203
|
if (isTruthy(spec.name.name)) docExports.push(this.descriptions.createDescription(spec.name, spec.name.name, document));
|