@nowline/lsp 0.8.6 → 0.9.0
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/providers/completion.d.ts +7 -1
- package/dist/providers/completion.d.ts.map +1 -1
- package/dist/providers/completion.js +42 -32
- package/dist/providers/completion.js.map +1 -1
- package/dist/providers/definition.d.ts +1 -1
- package/dist/providers/definition.js +1 -1
- package/dist/providers/document-symbols.d.ts +2 -1
- package/dist/providers/document-symbols.d.ts.map +1 -1
- package/dist/providers/document-symbols.js +25 -22
- package/dist/providers/document-symbols.js.map +1 -1
- package/dist/providers/hover.d.ts +9 -0
- package/dist/providers/hover.d.ts.map +1 -1
- package/dist/providers/hover.js +109 -14
- package/dist/providers/hover.js.map +1 -1
- package/dist/providers/references.d.ts.map +1 -1
- package/dist/providers/references.js +3 -1
- package/dist/providers/references.js.map +1 -1
- package/dist/providers/rename.d.ts.map +1 -1
- package/dist/providers/rename.js +2 -2
- package/dist/providers/rename.js.map +1 -1
- package/dist/references/ast-utils.d.ts +41 -31
- package/dist/references/ast-utils.d.ts.map +1 -1
- package/dist/references/ast-utils.js +54 -129
- package/dist/references/ast-utils.js.map +1 -1
- package/package.json +4 -4
- package/src/providers/completion.ts +42 -31
- package/src/providers/definition.ts +1 -1
- package/src/providers/document-symbols.ts +31 -21
- package/src/providers/hover.ts +124 -14
- package/src/providers/references.ts +2 -0
- package/src/providers/rename.ts +2 -1
- package/src/references/ast-utils.ts +81 -127
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rename.js","sourceRoot":"","sources":["../../src/providers/rename.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAanC,OAAO,EACH,aAAa,EACb,gBAAgB,EAChB,oBAAoB,EACpB,MAAM,EACN,eAAe,EACf,OAAO,EACP,mBAAmB,EACnB,kBAAkB,GACrB,MAAM,4BAA4B,CAAC;AAEpC;;;;;GAKG;AACH,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CAAC;QACpD,OAAO,EAAE,EAAE,EAAE,GAAG,CAAC,KAAK,EAAE,KAAK,EAAE,GAAG,CAAC,SAAS,CAAC,KAAK,EAAE,CAAC;IACzD,CAAC;IACD,OAAO,SAAS,CAAC;AACrB,CAAC;AAED,MAAM,KAAK,GAAG,2BAA2B,CAAC;AAC1C,SAAS,SAAS,CAAC,KAAa;IAC5B,OAAO,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AAC7B,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type { AnchorDeclaration, EntityProperty, FootnoteDeclaration, GroupBlock, ItemDeclaration, LabelDeclaration, MilestoneDeclaration, NowlineFile, ParallelBlock, PersonDeclaration, SizeDeclaration, StatusDeclaration, StyleDeclaration, SwimlaneDeclaration, SymbolDeclaration, TeamDeclaration } from '@nowline/core';
|
|
1
|
+
import type { AnchorDeclaration, EntityProperty, FootnoteDeclaration, GroupBlock, ItemDeclaration, LabelDeclaration, MilestoneDeclaration, NonWorkingDeclaration, NowlineFile, ParallelBlock, PersonDeclaration, SizeDeclaration, StatusDeclaration, StyleDeclaration, SwimlaneDeclaration, SymbolDeclaration, TeamDeclaration, WaveDeclaration, WorkingDeclaration } from '@nowline/core';
|
|
2
|
+
import { propKey, visitProperties } from '@nowline/core/internal';
|
|
2
3
|
import type { AstNode, CstNode, LangiumDocument } from 'langium';
|
|
3
4
|
import type { Range } from '../lsp-protocol.js';
|
|
4
5
|
/**
|
|
@@ -9,7 +10,7 @@ import type { Range } from '../lsp-protocol.js';
|
|
|
9
10
|
* Wider than the validator's `checkReferenceResolution` (which is strict only
|
|
10
11
|
* for sequencing — `after` / `before` / `on`). Categorisation references
|
|
11
12
|
* (`size` / `status` / `style` / `labels`), decoration references
|
|
12
|
-
* (`icon` / `capacity-icon`), and ownership
|
|
13
|
+
* (`icon` / `capacity-icon`), and the ownership reference (`owner`) are
|
|
13
14
|
* permissive in the validator (an undeclared id is not an error) but still
|
|
14
15
|
* navigable when a declaration exists.
|
|
15
16
|
*
|
|
@@ -17,25 +18,20 @@ import type { Range } from '../lsp-protocol.js';
|
|
|
17
18
|
* form was removed in favor of the spec-mandated reverse direction.
|
|
18
19
|
* Footnote association flows only from the footnote declaration's `on:`,
|
|
19
20
|
* and the validator now rejects `footnote:` as a property on host entities.
|
|
21
|
+
*
|
|
22
|
+
* Every key here must be one the validator accepts; `reference-keys.test.ts`
|
|
23
|
+
* checks that.
|
|
20
24
|
*/
|
|
21
25
|
export declare const REFERENCE_PROP_KEYS: Set<string>;
|
|
22
|
-
/** Status value-completion source: built-in statuses ship with the renderer. */
|
|
23
|
-
export declare const BUILTIN_STATUSES: readonly string[];
|
|
24
|
-
/**
|
|
25
|
-
* Built-in `capacity-icon:` vocabulary. Mirrors `BUILTIN_CAPACITY_ICONS` in
|
|
26
|
-
* the validator — kept as a literal here so the LSP doesn't have to import a
|
|
27
|
-
* non-public symbol from `@nowline/core`.
|
|
28
|
-
*/
|
|
29
|
-
export declare const BUILTIN_CAPACITY_ICONS: readonly string[];
|
|
30
26
|
/**
|
|
31
|
-
*
|
|
32
|
-
*
|
|
27
|
+
* Value-completion sources. The vocabularies are core's (`value-tables.ts`):
|
|
28
|
+
* the validator checks values against the same lists, so the editor offers
|
|
29
|
+
* exactly what validates. Kept as `@nowline/lsp` exports. `WEEKDAY_NAMES` is
|
|
30
|
+
* the weekday names `every:` takes, Sunday first.
|
|
33
31
|
*/
|
|
34
|
-
export
|
|
35
|
-
/**
|
|
36
|
-
export
|
|
37
|
-
key: string;
|
|
38
|
-
}): string;
|
|
32
|
+
export { BUILTIN_CAPACITY_ICONS, BUILTIN_ICON_NAMES, BUILTIN_STATUSES, CALENDAR_MODES, COLOR_NAMES, INCLUDE_MODES, NON_WORKING_DISPLAYS, STYLE_PROP_ENUMS, WEEKDAYS as WEEKDAY_NAMES, } from '@nowline/core/internal';
|
|
33
|
+
/** `prop.key` without a trailing `:` (core's, kept as an `@nowline/lsp` export). */
|
|
34
|
+
export { propKey };
|
|
39
35
|
/**
|
|
40
36
|
* Named declaration shapes we expose for navigation. All have `name?: string`,
|
|
41
37
|
* `title?: string`, and `properties?: EntityProperty[]`.
|
|
@@ -43,15 +39,28 @@ export declare function propKey(prop: {
|
|
|
43
39
|
* Includes both roadmap-section declarations (item, swimlane, person, …) and
|
|
44
40
|
* config-section declarations (`style`, `symbol`) so cmd+click on
|
|
45
41
|
* `style:enterprise-style` and `icon:my-symbol` resolves to the right place.
|
|
42
|
+
*
|
|
43
|
+
* `non-working` and `working` declarations are here so `declarationAt` (hover)
|
|
44
|
+
* sees them, but `collectNamedEntities` skips them: nothing references a
|
|
45
|
+
* calendar declaration by id, so they stay out of reference completion,
|
|
46
|
+
* definition and rename.
|
|
47
|
+
*/
|
|
48
|
+
export type NamedEntity = RoadmapEntryNamed | ItemDeclaration | ParallelBlock | GroupBlock | StyleDeclaration | SymbolDeclaration | NonWorkingDeclaration | WorkingDeclaration;
|
|
49
|
+
type RoadmapEntryNamed = SwimlaneDeclaration | AnchorDeclaration | MilestoneDeclaration | FootnoteDeclaration | PersonDeclaration | TeamDeclaration | LabelDeclaration | SizeDeclaration | StatusDeclaration | WaveDeclaration;
|
|
50
|
+
/**
|
|
51
|
+
* True for a `non-working` or `working` declaration. Hover describes them, but
|
|
52
|
+
* nothing references a calendar declaration by id, so definition, references
|
|
53
|
+
* and rename leave them alone.
|
|
46
54
|
*/
|
|
47
|
-
export
|
|
48
|
-
type RoadmapEntryNamed = SwimlaneDeclaration | AnchorDeclaration | MilestoneDeclaration | FootnoteDeclaration | PersonDeclaration | TeamDeclaration | LabelDeclaration | SizeDeclaration | StatusDeclaration;
|
|
55
|
+
export declare function isCalendarDeclaration(entity: AstNode): boolean;
|
|
49
56
|
/**
|
|
50
|
-
*
|
|
51
|
-
* roadmap
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
* `
|
|
57
|
+
* Collect every entity that owns an `id`, in the order of core's declaration
|
|
58
|
+
* walk (config entries first, then roadmap entries with their track content or
|
|
59
|
+
* nested teams): the roadmap-section entities `@nowline/core`'s
|
|
60
|
+
* `referenceableIds` covers, plus the named config-section declarations
|
|
61
|
+
* (`style`, `symbol`) so style and symbol references navigate correctly.
|
|
62
|
+
* The LSP skips the roadmap line itself (not walked here) and the calendar
|
|
63
|
+
* declarations (`isCalendarDeclaration`); anonymous declarations have no id.
|
|
55
64
|
*/
|
|
56
65
|
export declare function collectNamedEntities(file: NowlineFile): NamedEntity[];
|
|
57
66
|
/**
|
|
@@ -61,7 +70,7 @@ export declare function collectNamedEntities(file: NowlineFile): NamedEntity[];
|
|
|
61
70
|
*/
|
|
62
71
|
export declare function buildEntityIndex(file: NowlineFile): Map<string, NamedEntity>;
|
|
63
72
|
/** Visit every `EntityProperty` reachable from a roadmap entry, depth-first. */
|
|
64
|
-
export
|
|
73
|
+
export { visitProperties };
|
|
65
74
|
/**
|
|
66
75
|
* Iterate every `EntityProperty` in the file, including those on the roadmap
|
|
67
76
|
* declaration itself, plus the properties on top-level config entries (style /
|
|
@@ -93,7 +102,8 @@ export declare function propertyValueAt(leaf: CstNode | undefined): {
|
|
|
93
102
|
} | undefined;
|
|
94
103
|
/**
|
|
95
104
|
* When `leaf` is the `name=ID` token of a named entity declaration, return the
|
|
96
|
-
* declaring entity. Returns `undefined` for any other position
|
|
105
|
+
* declaring entity. Returns `undefined` for any other position, including the
|
|
106
|
+
* declaration keyword (`wave wave "W"` names its wave after the keyword).
|
|
97
107
|
*/
|
|
98
108
|
export declare function declarationAt(leaf: CstNode | undefined): NamedEntity | undefined;
|
|
99
109
|
/**
|
|
@@ -111,10 +121,11 @@ export declare function findDeclarationRange(file: NowlineFile, id: string): Ran
|
|
|
111
121
|
*/
|
|
112
122
|
export declare function entityKind(entity: AstNode): string;
|
|
113
123
|
/**
|
|
114
|
-
* Find the
|
|
115
|
-
*
|
|
116
|
-
*
|
|
117
|
-
*
|
|
124
|
+
* Find the range of the given entity's `name=ID` token. Uses the grammar
|
|
125
|
+
* assignment rather than matching leaf text, so a name that equals the
|
|
126
|
+
* declaration keyword (`wave wave "W"`) resolves to the name, not the
|
|
127
|
+
* keyword. Returns `undefined` when the entity has no `name` (anonymous
|
|
128
|
+
* declaration) or no CST node.
|
|
118
129
|
*/
|
|
119
130
|
export declare function nameRangeOf(entity: AstNode): Range | undefined;
|
|
120
131
|
/**
|
|
@@ -122,5 +133,4 @@ export declare function nameRangeOf(entity: AstNode): Range | undefined;
|
|
|
122
133
|
* `CstUtils.flattenCst` so call sites don't need to import the namespace.
|
|
123
134
|
*/
|
|
124
135
|
export declare function flattenLeaves(root: CstNode): IterableIterator<CstNode>;
|
|
125
|
-
export {};
|
|
126
136
|
//# sourceMappingURL=ast-utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ast-utils.d.ts","sourceRoot":"","sources":["../../src/references/ast-utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACR,iBAAiB,EACjB,cAAc,EACd,mBAAmB,EACnB,UAAU,
|
|
1
|
+
{"version":3,"file":"ast-utils.d.ts","sourceRoot":"","sources":["../../src/references/ast-utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACR,iBAAiB,EACjB,cAAc,EACd,mBAAmB,EACnB,UAAU,EACV,eAAe,EACf,gBAAgB,EAChB,oBAAoB,EACpB,qBAAqB,EACrB,WAAW,EACX,aAAa,EACb,iBAAiB,EACjB,eAAe,EACf,iBAAiB,EACjB,gBAAgB,EAChB,mBAAmB,EACnB,iBAAiB,EACjB,eAAe,EACf,eAAe,EACf,kBAAkB,EACrB,MAAM,eAAe,CAAC;AAqBvB,OAAO,EAAgB,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAChF,OAAO,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAEjE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAEhD;;;;;;;;;;;;;;;;;;;GA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AE,eAAe,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,CAIrF;AAED;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAC3B,IAAI,EAAE,OAAO,GAAG,SAAS,GAC1B;IAAE,IAAI,EAAE,cAAc,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,OAAO,CAAA;CAAE,GAAG,SAAS,CAczE;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,OAAO,GAAG,SAAS,GAAG,WAAW,GAAG,SAAS,CA6BhF;AAED;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,WAAW,EAAE,EAAE,EAAE,MAAM,GAAG,KAAK,GAAG,SAAS,CAQrF;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,CAOlD;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,OAAO,GAAG,KAAK,GAAG,SAAS,CAE9D;AASD;;;GAGG;AACH,wBAAiB,aAAa,CAAC,IAAI,EAAE,OAAO,GAAG,gBAAgB,CAAC,OAAO,CAAC,CAEvE"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { isAnchorDeclaration, isFootnoteDeclaration, isGroupBlock, isItemDeclaration, isLabelDeclaration, isMilestoneDeclaration, isNowlineFile, isParallelBlock, isPersonDeclaration,
|
|
2
|
-
import {
|
|
1
|
+
import { isAnchorDeclaration, isFootnoteDeclaration, isGroupBlock, isItemDeclaration, isLabelDeclaration, isMilestoneDeclaration, isNonWorkingDeclaration, isNowlineFile, isParallelBlock, isPersonDeclaration, isSizeDeclaration, isStatusDeclaration, isStyleDeclaration, isSwimlaneDeclaration, isSymbolDeclaration, isTeamDeclaration, isWaveDeclaration, isWorkingDeclaration, } from '@nowline/core';
|
|
2
|
+
import { declarations, propKey, visitProperties } from '@nowline/core/internal';
|
|
3
|
+
import { CstUtils, GrammarUtils } from 'langium';
|
|
3
4
|
/**
|
|
4
5
|
* Property keys whose value(s) name another entity in the same file. Used by
|
|
5
6
|
* definition / references / rename / completion to decide whether the cursor
|
|
@@ -8,7 +9,7 @@ import { CstUtils } from 'langium';
|
|
|
8
9
|
* Wider than the validator's `checkReferenceResolution` (which is strict only
|
|
9
10
|
* for sequencing — `after` / `before` / `on`). Categorisation references
|
|
10
11
|
* (`size` / `status` / `style` / `labels`), decoration references
|
|
11
|
-
* (`icon` / `capacity-icon`), and ownership
|
|
12
|
+
* (`icon` / `capacity-icon`), and the ownership reference (`owner`) are
|
|
12
13
|
* permissive in the validator (an undeclared id is not an error) but still
|
|
13
14
|
* navigable when a declaration exists.
|
|
14
15
|
*
|
|
@@ -16,119 +17,55 @@ import { CstUtils } from 'langium';
|
|
|
16
17
|
* form was removed in favor of the spec-mandated reverse direction.
|
|
17
18
|
* Footnote association flows only from the footnote declaration's `on:`,
|
|
18
19
|
* and the validator now rejects `footnote:` as a property on host entities.
|
|
20
|
+
*
|
|
21
|
+
* Every key here must be one the validator accepts; `reference-keys.test.ts`
|
|
22
|
+
* checks that.
|
|
19
23
|
*/
|
|
20
24
|
export const REFERENCE_PROP_KEYS = new Set([
|
|
21
25
|
'after',
|
|
22
26
|
'before',
|
|
23
|
-
'depends',
|
|
24
27
|
'on',
|
|
25
28
|
'owner',
|
|
26
|
-
'team',
|
|
27
29
|
'size',
|
|
28
30
|
'status',
|
|
29
31
|
'style',
|
|
30
32
|
'labels',
|
|
31
33
|
'icon',
|
|
32
34
|
'capacity-icon',
|
|
35
|
+
'wave',
|
|
33
36
|
]);
|
|
34
|
-
/** Status value-completion source: built-in statuses ship with the renderer. */
|
|
35
|
-
export const BUILTIN_STATUSES = [
|
|
36
|
-
'planned',
|
|
37
|
-
'in-progress',
|
|
38
|
-
'done',
|
|
39
|
-
'at-risk',
|
|
40
|
-
'blocked',
|
|
41
|
-
];
|
|
42
37
|
/**
|
|
43
|
-
*
|
|
44
|
-
* the validator
|
|
45
|
-
*
|
|
38
|
+
* Value-completion sources. The vocabularies are core's (`value-tables.ts`):
|
|
39
|
+
* the validator checks values against the same lists, so the editor offers
|
|
40
|
+
* exactly what validates. Kept as `@nowline/lsp` exports. `WEEKDAY_NAMES` is
|
|
41
|
+
* the weekday names `every:` takes, Sunday first.
|
|
46
42
|
*/
|
|
47
|
-
export
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
'person',
|
|
51
|
-
'people',
|
|
52
|
-
'points',
|
|
53
|
-
'time',
|
|
54
|
-
];
|
|
43
|
+
export { BUILTIN_CAPACITY_ICONS, BUILTIN_ICON_NAMES, BUILTIN_STATUSES, CALENDAR_MODES, COLOR_NAMES, INCLUDE_MODES, NON_WORKING_DISPLAYS, STYLE_PROP_ENUMS, WEEKDAYS as WEEKDAY_NAMES, } from '@nowline/core/internal';
|
|
44
|
+
/** `prop.key` without a trailing `:` (core's, kept as an `@nowline/lsp` export). */
|
|
45
|
+
export { propKey };
|
|
55
46
|
/**
|
|
56
|
-
*
|
|
57
|
-
*
|
|
47
|
+
* True for a `non-working` or `working` declaration. Hover describes them, but
|
|
48
|
+
* nothing references a calendar declaration by id, so definition, references
|
|
49
|
+
* and rename leave them alone.
|
|
58
50
|
*/
|
|
59
|
-
export
|
|
60
|
-
|
|
61
|
-
'shield',
|
|
62
|
-
'warning',
|
|
63
|
-
'lock',
|
|
64
|
-
];
|
|
65
|
-
/** Strip the trailing `:` an `EntityProperty.key` carries from the grammar. */
|
|
66
|
-
export function propKey(prop) {
|
|
67
|
-
return prop.key.endsWith(':') ? prop.key.slice(0, -1) : prop.key;
|
|
51
|
+
export function isCalendarDeclaration(entity) {
|
|
52
|
+
return isNonWorkingDeclaration(entity) || isWorkingDeclaration(entity);
|
|
68
53
|
}
|
|
69
54
|
/**
|
|
70
|
-
*
|
|
71
|
-
* roadmap
|
|
72
|
-
*
|
|
73
|
-
*
|
|
74
|
-
* `
|
|
55
|
+
* Collect every entity that owns an `id`, in the order of core's declaration
|
|
56
|
+
* walk (config entries first, then roadmap entries with their track content or
|
|
57
|
+
* nested teams): the roadmap-section entities `@nowline/core`'s
|
|
58
|
+
* `referenceableIds` covers, plus the named config-section declarations
|
|
59
|
+
* (`style`, `symbol`) so style and symbol references navigate correctly.
|
|
60
|
+
* The LSP skips the roadmap line itself (not walked here) and the calendar
|
|
61
|
+
* declarations (`isCalendarDeclaration`); anonymous declarations have no id.
|
|
75
62
|
*/
|
|
76
63
|
export function collectNamedEntities(file) {
|
|
77
64
|
const out = [];
|
|
78
|
-
for (const
|
|
79
|
-
if (
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
out.push(entry);
|
|
83
|
-
}
|
|
84
|
-
const visitTeam = (team) => {
|
|
85
|
-
if (team.name)
|
|
86
|
-
out.push(team);
|
|
87
|
-
for (const c of team.content) {
|
|
88
|
-
if (isTeamDeclaration(c))
|
|
89
|
-
visitTeam(c);
|
|
90
|
-
// `PersonMemberRef` and `DescriptionDirective` are references / prose,
|
|
91
|
-
// not declarations — skip.
|
|
92
|
-
else if (isPersonMemberRef(c)) {
|
|
93
|
-
/* skip */
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
};
|
|
97
|
-
const visitTrackChild = (child) => {
|
|
98
|
-
if (isItemDeclaration(child) && child.name)
|
|
99
|
-
out.push(child);
|
|
100
|
-
else if (isParallelBlock(child)) {
|
|
101
|
-
if (child.name)
|
|
102
|
-
out.push(child);
|
|
103
|
-
for (const sub of child.content)
|
|
104
|
-
visitTrackChild(sub);
|
|
105
|
-
}
|
|
106
|
-
else if (isGroupBlock(child)) {
|
|
107
|
-
if (child.name)
|
|
108
|
-
out.push(child);
|
|
109
|
-
for (const sub of child.content)
|
|
110
|
-
visitTrackChild(sub);
|
|
111
|
-
}
|
|
112
|
-
};
|
|
113
|
-
for (const entry of file.roadmapEntries) {
|
|
114
|
-
if (isSwimlaneDeclaration(entry)) {
|
|
115
|
-
if (entry.name)
|
|
116
|
-
out.push(entry);
|
|
117
|
-
for (const c of entry.content)
|
|
118
|
-
visitTrackChild(c);
|
|
119
|
-
}
|
|
120
|
-
else if (isTeamDeclaration(entry))
|
|
121
|
-
visitTeam(entry);
|
|
122
|
-
else if (isPersonDeclaration(entry) ||
|
|
123
|
-
isAnchorDeclaration(entry) ||
|
|
124
|
-
isMilestoneDeclaration(entry) ||
|
|
125
|
-
isFootnoteDeclaration(entry) ||
|
|
126
|
-
isLabelDeclaration(entry) ||
|
|
127
|
-
isSizeDeclaration(entry) ||
|
|
128
|
-
isStatusDeclaration(entry)) {
|
|
129
|
-
if (entry.name)
|
|
130
|
-
out.push(entry);
|
|
131
|
-
}
|
|
65
|
+
for (const node of declarations(file, { config: true })) {
|
|
66
|
+
if (!node.name || isCalendarDeclaration(node))
|
|
67
|
+
continue;
|
|
68
|
+
out.push(node);
|
|
132
69
|
}
|
|
133
70
|
return out;
|
|
134
71
|
}
|
|
@@ -147,30 +84,7 @@ export function buildEntityIndex(file) {
|
|
|
147
84
|
return index;
|
|
148
85
|
}
|
|
149
86
|
/** Visit every `EntityProperty` reachable from a roadmap entry, depth-first. */
|
|
150
|
-
export
|
|
151
|
-
const walk = (n) => {
|
|
152
|
-
const props = n.properties;
|
|
153
|
-
if (Array.isArray(props)) {
|
|
154
|
-
for (const p of props)
|
|
155
|
-
visit(p, n);
|
|
156
|
-
}
|
|
157
|
-
if (isSwimlaneDeclaration(n)) {
|
|
158
|
-
for (const c of n.content)
|
|
159
|
-
walk(c);
|
|
160
|
-
}
|
|
161
|
-
else if (isParallelBlock(n) || isGroupBlock(n)) {
|
|
162
|
-
for (const c of n.content)
|
|
163
|
-
walk(c);
|
|
164
|
-
}
|
|
165
|
-
else if (isTeamDeclaration(n)) {
|
|
166
|
-
for (const c of n.content) {
|
|
167
|
-
if (isTeamDeclaration(c) || isPersonDeclaration(c))
|
|
168
|
-
walk(c);
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
};
|
|
172
|
-
walk(node);
|
|
173
|
-
}
|
|
87
|
+
export { visitProperties };
|
|
174
88
|
/**
|
|
175
89
|
* Iterate every `EntityProperty` in the file, including those on the roadmap
|
|
176
90
|
* declaration itself, plus the properties on top-level config entries (style /
|
|
@@ -230,7 +144,8 @@ export function propertyValueAt(leaf) {
|
|
|
230
144
|
}
|
|
231
145
|
/**
|
|
232
146
|
* When `leaf` is the `name=ID` token of a named entity declaration, return the
|
|
233
|
-
* declaring entity. Returns `undefined` for any other position
|
|
147
|
+
* declaring entity. Returns `undefined` for any other position, including the
|
|
148
|
+
* declaration keyword (`wave wave "W"` names its wave after the keyword).
|
|
234
149
|
*/
|
|
235
150
|
export function declarationAt(leaf) {
|
|
236
151
|
if (!leaf)
|
|
@@ -240,6 +155,9 @@ export function declarationAt(leaf) {
|
|
|
240
155
|
return undefined;
|
|
241
156
|
if (owner.name !== leaf.text)
|
|
242
157
|
return undefined;
|
|
158
|
+
const nameNode = nameNodeOf(owner);
|
|
159
|
+
if (!nameNode || leaf.offset < nameNode.offset || leaf.end > nameNode.end)
|
|
160
|
+
return undefined;
|
|
243
161
|
if (isSwimlaneDeclaration(owner) ||
|
|
244
162
|
isItemDeclaration(owner) ||
|
|
245
163
|
isParallelBlock(owner) ||
|
|
@@ -252,8 +170,11 @@ export function declarationAt(leaf) {
|
|
|
252
170
|
isLabelDeclaration(owner) ||
|
|
253
171
|
isSizeDeclaration(owner) ||
|
|
254
172
|
isStatusDeclaration(owner) ||
|
|
173
|
+
isWaveDeclaration(owner) ||
|
|
255
174
|
isStyleDeclaration(owner) ||
|
|
256
|
-
isSymbolDeclaration(owner)
|
|
175
|
+
isSymbolDeclaration(owner) ||
|
|
176
|
+
isNonWorkingDeclaration(owner) ||
|
|
177
|
+
isWorkingDeclaration(owner)) {
|
|
257
178
|
return owner;
|
|
258
179
|
}
|
|
259
180
|
return undefined;
|
|
@@ -281,26 +202,30 @@ export function findDeclarationRange(file, id) {
|
|
|
281
202
|
* Render a one-line "type id" label used by hover and document-symbols.
|
|
282
203
|
*/
|
|
283
204
|
export function entityKind(entity) {
|
|
205
|
+
// `NonWorkingDeclaration` would lowercase to `nonworking`; the keyword is hyphenated.
|
|
206
|
+
if (entity.$type === 'NonWorkingDeclaration')
|
|
207
|
+
return 'non-working';
|
|
284
208
|
return entity.$type
|
|
285
209
|
.replace(/Declaration$/, '')
|
|
286
210
|
.replace(/Block$/, '')
|
|
287
211
|
.toLowerCase();
|
|
288
212
|
}
|
|
289
213
|
/**
|
|
290
|
-
* Find the
|
|
291
|
-
*
|
|
292
|
-
*
|
|
293
|
-
*
|
|
214
|
+
* Find the range of the given entity's `name=ID` token. Uses the grammar
|
|
215
|
+
* assignment rather than matching leaf text, so a name that equals the
|
|
216
|
+
* declaration keyword (`wave wave "W"`) resolves to the name, not the
|
|
217
|
+
* keyword. Returns `undefined` when the entity has no `name` (anonymous
|
|
218
|
+
* declaration) or no CST node.
|
|
294
219
|
*/
|
|
295
220
|
export function nameRangeOf(entity) {
|
|
221
|
+
return nameNodeOf(entity)?.range;
|
|
222
|
+
}
|
|
223
|
+
// The CST node assigned to the entity's `name` property.
|
|
224
|
+
function nameNodeOf(entity) {
|
|
296
225
|
const name = entity.name;
|
|
297
226
|
if (!name || !entity.$cstNode)
|
|
298
227
|
return undefined;
|
|
299
|
-
|
|
300
|
-
if (leaf.text === name)
|
|
301
|
-
return leaf.range;
|
|
302
|
-
}
|
|
303
|
-
return undefined;
|
|
228
|
+
return GrammarUtils.findNodeForProperty(entity.$cstNode, 'name');
|
|
304
229
|
}
|
|
305
230
|
/**
|
|
306
231
|
* Iterate every leaf CST node inside the given root. Convenience wrapper over
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ast-utils.js","sourceRoot":"","sources":["../../src/references/ast-utils.ts"],"names":[],"mappings":"AAqBA,OAAO,EACH,mBAAmB,EACnB,qBAAqB,EACrB,YAAY,EACZ,iBAAiB,EACjB,kBAAkB,EAClB,sBAAsB,EACtB,aAAa,EACb,eAAe,EACf,mBAAmB,EACnB,iBAAiB,EACjB,
|
|
1
|
+
{"version":3,"file":"ast-utils.js","sourceRoot":"","sources":["../../src/references/ast-utils.ts"],"names":[],"mappings":"AAqBA,OAAO,EACH,mBAAmB,EACnB,qBAAqB,EACrB,YAAY,EACZ,iBAAiB,EACjB,kBAAkB,EAClB,sBAAsB,EACtB,uBAAuB,EACvB,aAAa,EACb,eAAe,EACf,mBAAmB,EACnB,iBAAiB,EACjB,mBAAmB,EACnB,kBAAkB,EAClB,qBAAqB,EACrB,mBAAmB,EACnB,iBAAiB,EACjB,iBAAiB,EACjB,oBAAoB,GACvB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEhF,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAGjD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,IAAI,GAAG,CAAC;IACvC,OAAO;IACP,QAAQ;IACR,IAAI;IACJ,OAAO;IACP,MAAM;IACN,QAAQ;IACR,OAAO;IACP,QAAQ;IACR,MAAM;IACN,eAAe;IACf,MAAM;CACT,CAAC,CAAC;AAEH;;;;;GAKG;AACH,OAAO,EACH,sBAAsB,EACtB,kBAAkB,EAClB,gBAAgB,EAChB,cAAc,EACd,WAAW,EACX,aAAa,EACb,oBAAoB,EACpB,gBAAgB,EAChB,QAAQ,IAAI,aAAa,GAC5B,MAAM,wBAAwB,CAAC;AAEhC,oFAAoF;AACpF,OAAO,EAAE,OAAO,EAAE,CAAC;AAqCnB;;;;GAIG;AACH,MAAM,UAAU,qBAAqB,CAAC,MAAe;IACjD,OAAO,uBAAuB,CAAC,MAAM,CAAC,IAAI,oBAAoB,CAAC,MAAM,CAAC,CAAC;AAC3E,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,oBAAoB,CAAC,IAAiB;IAClD,MAAM,GAAG,GAAkB,EAAE,CAAC;IAC9B,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E,EAAE,CAAC;YAClB,MAAM,KAAK,GAAG,WAAW,CAAC,GAAG,CAAC,CAAC;YAC/B,IAAI,KAAK;gBAAE,OAAO,KAAK,CAAC;QAC5B,CAAC;IACL,CAAC;IACD,OAAO,SAAS,CAAC;AACrB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,UAAU,CAAC,MAAe;IACtC,sFAAsF;IACtF,IAAI,MAAM,CAAC,KAAK,KAAK,uBAAuB;QAAE,OAAO,aAAa,CAAC;IACnE,OAAO,MAAM,CAAC,KAAK;SACd,OAAO,CAAC,cAAc,EAAE,EAAE,CAAC;SAC3B,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC;SACrB,WAAW,EAAE,CAAC;AACvB,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,WAAW,CAAC,MAAe;IACvC,OAAO,UAAU,CAAC,MAAM,CAAC,EAAE,KAAK,CAAC;AACrC,CAAC;AAED,yDAAyD;AACzD,SAAS,UAAU,CAAC,MAAe;IAC/B,MAAM,IAAI,GAAI,MAA4B,CAAC,IAAI,CAAC;IAChD,IAAI,CAAC,IAAI,IAAI,CAAC,MAAM,CAAC,QAAQ;QAAE,OAAO,SAAS,CAAC;IAChD,OAAO,YAAY,CAAC,mBAAmB,CAAC,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;AACrE,CAAC;AAED;;;GAGG;AACH,MAAM,SAAS,CAAC,CAAC,aAAa,CAAC,IAAa;IACxC,KAAK,MAAM,IAAI,IAAI,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC;QAAE,MAAM,IAAI,CAAC;AAC7D,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nowline/lsp",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"description": "Nowline language server — powers editor features like error checking, autocomplete, and hovers in VS Code, Cursor, and other editors.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"engines": {
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"src/"
|
|
29
29
|
],
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@nowline/core": "0.
|
|
31
|
+
"@nowline/core": "0.9.0",
|
|
32
32
|
"langium": "~4.4.0",
|
|
33
33
|
"vscode-languageserver": "~10.1.2",
|
|
34
34
|
"vscode-languageserver-protocol": "~3.18.4",
|
|
@@ -36,9 +36,9 @@
|
|
|
36
36
|
"vscode-languageserver-types": "~3.18.4"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"@types/node": "^26.6.
|
|
39
|
+
"@types/node": "^26.6.5",
|
|
40
40
|
"typescript": "^7.0.2",
|
|
41
|
-
"vitest": "^5.0.
|
|
41
|
+
"vitest": "^5.0.5"
|
|
42
42
|
},
|
|
43
43
|
"scripts": {
|
|
44
44
|
"build": "tsc -b tsconfig.json",
|
|
@@ -11,11 +11,17 @@ import {
|
|
|
11
11
|
BUILTIN_CAPACITY_ICONS,
|
|
12
12
|
BUILTIN_ICON_NAMES,
|
|
13
13
|
BUILTIN_STATUSES,
|
|
14
|
+
CALENDAR_MODES,
|
|
15
|
+
COLOR_NAMES,
|
|
14
16
|
collectNamedEntities,
|
|
15
17
|
entityKind,
|
|
16
18
|
fileFromDocument,
|
|
19
|
+
INCLUDE_MODES,
|
|
17
20
|
type NamedEntity,
|
|
21
|
+
NON_WORKING_DISPLAYS,
|
|
18
22
|
REFERENCE_PROP_KEYS,
|
|
23
|
+
STYLE_PROP_ENUMS,
|
|
24
|
+
WEEKDAY_NAMES,
|
|
19
25
|
} from '../references/ast-utils.js';
|
|
20
26
|
|
|
21
27
|
/**
|
|
@@ -27,31 +33,42 @@ import {
|
|
|
27
33
|
* (`StyleDeclaration` → `style`, `ItemDeclaration` → `item`, …).
|
|
28
34
|
*/
|
|
29
35
|
const REF_KEY_TO_KINDS: Record<string, ReadonlySet<string>> = {
|
|
30
|
-
after: new Set(['item', 'milestone', 'anchor', 'parallel', 'group']),
|
|
31
|
-
before: new Set(['item', 'milestone', 'anchor', 'parallel', 'group']),
|
|
32
|
-
|
|
33
|
-
on: new Set(['item', 'swimlane', 'parallel', 'group', 'milestone']),
|
|
36
|
+
after: new Set(['item', 'milestone', 'anchor', 'parallel', 'group', 'wave']),
|
|
37
|
+
before: new Set(['item', 'milestone', 'anchor', 'parallel', 'group', 'wave']),
|
|
38
|
+
on: new Set(['item', 'swimlane', 'parallel', 'group', 'milestone', 'wave']),
|
|
34
39
|
owner: new Set(['person', 'team']),
|
|
35
|
-
team: new Set(['team']),
|
|
36
40
|
style: new Set(['style']),
|
|
37
41
|
size: new Set(['size']),
|
|
38
42
|
status: new Set(['status']),
|
|
39
43
|
labels: new Set(['label']),
|
|
40
44
|
icon: new Set(['symbol']),
|
|
41
45
|
'capacity-icon': new Set(['symbol']),
|
|
46
|
+
wave: new Set(['wave']),
|
|
42
47
|
};
|
|
43
48
|
|
|
49
|
+
/** Style keys whose value is a colour (the validator's `isColorValue` keys). */
|
|
50
|
+
const COLOR_KEYS: ReadonlySet<string> = new Set(['bg', 'fg', 'text']);
|
|
51
|
+
|
|
52
|
+
/** Keys on an `include` line; both take an include mode. */
|
|
53
|
+
const INCLUDE_MODE_KEYS: ReadonlySet<string> = new Set(['config', 'roadmap']);
|
|
54
|
+
|
|
44
55
|
/**
|
|
45
56
|
* Custom completion provider. Defers to Langium's keyword + property-key
|
|
46
57
|
* completion (free from the grammar) and adds:
|
|
47
58
|
*
|
|
48
59
|
* - Id-reference completion when the cursor sits in a reference property's
|
|
49
|
-
* value position (`after:`, `before:`, `style:`, `size:`, `labels:[...]`,
|
|
60
|
+
* value position (`after:`, `before:`, `style:`, `size:`, `wave:`, `labels:[...]`,
|
|
50
61
|
* etc.). Each key only suggests entities whose kind makes sense for it
|
|
51
62
|
* (see `REF_KEY_TO_KINDS`).
|
|
52
63
|
* - Status-value completion: built-in values plus custom `status`
|
|
53
64
|
* declarations.
|
|
54
65
|
* - Icon / capacity-icon built-in vocabulary plus user-declared symbols.
|
|
66
|
+
* - Working-calendar values: the weekday names after `every:` and `hide` /
|
|
67
|
+
* `show` after the `non-working:` display key.
|
|
68
|
+
* - Style values: each enumerated style key's values, and the built-in
|
|
69
|
+
* colour names after `bg:`, `fg:` and `text:` (hex stays free-form).
|
|
70
|
+
* - `calendar:` modes on the roadmap line and `config:` / `roadmap:` modes
|
|
71
|
+
* on an `include` line.
|
|
55
72
|
*/
|
|
56
73
|
export class NowlineCompletionProvider extends DefaultCompletionProvider {
|
|
57
74
|
constructor(services: NowlineLspServices) {
|
|
@@ -82,36 +99,28 @@ export class NowlineCompletionProvider extends DefaultCompletionProvider {
|
|
|
82
99
|
const file = fileFromDocument(context.document);
|
|
83
100
|
if (!file) return;
|
|
84
101
|
|
|
85
|
-
|
|
86
|
-
for (const
|
|
87
|
-
acceptor(context, {
|
|
88
|
-
label: status,
|
|
89
|
-
kind: CompletionItemKind.EnumMember,
|
|
90
|
-
detail: 'built-in status',
|
|
91
|
-
insertText: status,
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
if (hint.key === 'icon') {
|
|
96
|
-
for (const icon of BUILTIN_ICON_NAMES) {
|
|
102
|
+
const offer = (values: readonly string[], detail: string): void => {
|
|
103
|
+
for (const value of values) {
|
|
97
104
|
acceptor(context, {
|
|
98
|
-
label:
|
|
105
|
+
label: value,
|
|
99
106
|
kind: CompletionItemKind.EnumMember,
|
|
100
|
-
detail
|
|
101
|
-
insertText:
|
|
102
|
-
});
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
if (hint.key === 'capacity-icon') {
|
|
106
|
-
for (const icon of BUILTIN_CAPACITY_ICONS) {
|
|
107
|
-
acceptor(context, {
|
|
108
|
-
label: icon,
|
|
109
|
-
kind: CompletionItemKind.EnumMember,
|
|
110
|
-
detail: 'built-in capacity icon',
|
|
111
|
-
insertText: icon,
|
|
107
|
+
detail,
|
|
108
|
+
insertText: value,
|
|
112
109
|
});
|
|
113
110
|
}
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
if (hint.key === 'status') offer(BUILTIN_STATUSES, 'built-in status');
|
|
114
|
+
if (hint.key === 'every') offer(WEEKDAY_NAMES, 'weekday');
|
|
115
|
+
if (hint.key === 'non-working') offer(NON_WORKING_DISPLAYS, 'non-working display');
|
|
116
|
+
if (hint.key === 'icon') offer(BUILTIN_ICON_NAMES, 'built-in icon');
|
|
117
|
+
if (hint.key === 'capacity-icon') offer(BUILTIN_CAPACITY_ICONS, 'built-in capacity icon');
|
|
118
|
+
if (Object.hasOwn(STYLE_PROP_ENUMS, hint.key)) {
|
|
119
|
+
offer(STYLE_PROP_ENUMS[hint.key], `${hint.key} value`);
|
|
114
120
|
}
|
|
121
|
+
if (COLOR_KEYS.has(hint.key)) offer(COLOR_NAMES, 'built-in color');
|
|
122
|
+
if (hint.key === 'calendar') offer(CALENDAR_MODES, 'calendar mode');
|
|
123
|
+
if (INCLUDE_MODE_KEYS.has(hint.key)) offer(INCLUDE_MODES, 'include mode');
|
|
115
124
|
|
|
116
125
|
if (REFERENCE_PROP_KEYS.has(hint.key)) {
|
|
117
126
|
const allowed = REF_KEY_TO_KINDS[hint.key];
|
|
@@ -196,6 +205,8 @@ function kindFor(kind: string): CompletionItemKind {
|
|
|
196
205
|
return CompletionItemKind.Snippet;
|
|
197
206
|
case 'footnote':
|
|
198
207
|
return CompletionItemKind.Text;
|
|
208
|
+
case 'wave':
|
|
209
|
+
return CompletionItemKind.Struct;
|
|
199
210
|
default:
|
|
200
211
|
return CompletionItemKind.Reference;
|
|
201
212
|
}
|
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
* text) for cross-references, so Langium's default cross-ref-aware provider
|
|
19
19
|
* has nothing to follow. We walk the AST instead: when the cursor sits on a
|
|
20
20
|
* value of a reference property (`after:`, `before:`, `owner:`, `on:`,
|
|
21
|
-
* `
|
|
21
|
+
* `labels:[]`, ...), look up the target id in the file-level entity index and
|
|
22
22
|
* return its declaration site.
|
|
23
23
|
*/
|
|
24
24
|
export class NowlineDefinitionProvider implements DefinitionProvider {
|