dot-language-support 2.2.2 → 2.2.4

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.
Files changed (89) hide show
  1. package/.github/workflows/CD.yml +5 -2
  2. package/.github/workflows/CI.yml +5 -2
  3. package/.github/workflows/auto-merge.yaml +1 -1
  4. package/biome.json +50 -0
  5. package/lib/cjs/binder.d.ts +1 -1
  6. package/lib/cjs/binder.js +2 -5
  7. package/lib/cjs/checker.d.ts +1 -1
  8. package/lib/cjs/checker.js +34 -30
  9. package/lib/cjs/core.js +2 -3
  10. package/lib/cjs/error.js +3 -5
  11. package/lib/cjs/parser.d.ts +4 -61
  12. package/lib/cjs/parser.js +580 -616
  13. package/lib/cjs/scanner.d.ts +2 -13
  14. package/lib/cjs/scanner.js +316 -317
  15. package/lib/cjs/service/codeAction.d.ts +3 -3
  16. package/lib/cjs/service/codeAction.js +45 -39
  17. package/lib/cjs/service/colorProvider.d.ts +3 -3
  18. package/lib/cjs/service/colorProvider.js +30 -31
  19. package/lib/cjs/service/command/ChangeAllOtherEdgeOpsAndFixGraphCommand.d.ts +4 -4
  20. package/lib/cjs/service/command/ChangeAllOtherEdgeOpsAndFixGraphCommand.js +5 -6
  21. package/lib/cjs/service/command/ChangeEdgeOpCommand.d.ts +3 -3
  22. package/lib/cjs/service/command/ChangeEdgeOpCommand.js +22 -15
  23. package/lib/cjs/service/command/ConsolidateDescendantsCommand.d.ts +4 -4
  24. package/lib/cjs/service/command/ConsolidateDescendantsCommand.js +12 -13
  25. package/lib/cjs/service/command/RemoveSemicolons.d.ts +4 -4
  26. package/lib/cjs/service/command/RemoveSemicolons.js +8 -11
  27. package/lib/cjs/service/command/common.d.ts +4 -4
  28. package/lib/cjs/service/command/common.js +12 -10
  29. package/lib/cjs/service/completion.d.ts +2 -2
  30. package/lib/cjs/service/completion.js +34 -25
  31. package/lib/cjs/service/hover.d.ts +2 -2
  32. package/lib/cjs/service/hover.js +12 -16
  33. package/lib/cjs/service/languageFacts.js +1 -6
  34. package/lib/cjs/service/reference.d.ts +2 -2
  35. package/lib/cjs/service/reference.js +4 -8
  36. package/lib/cjs/service/rename.d.ts +3 -3
  37. package/lib/cjs/service/rename.js +10 -8
  38. package/lib/cjs/service/service.d.ts +3 -3
  39. package/lib/cjs/service/service.js +7 -8
  40. package/lib/cjs/service/util.d.ts +1 -1
  41. package/lib/cjs/service/util.js +10 -13
  42. package/lib/cjs/service/validation.d.ts +3 -3
  43. package/lib/cjs/service/validation.js +1 -2
  44. package/lib/cjs/tester.js +1 -1
  45. package/lib/cjs/visitor.d.ts +1 -1
  46. package/lib/cjs/visitor.js +32 -34
  47. package/lib/esm/binder.d.ts +1 -1
  48. package/lib/esm/binder.js +1 -3
  49. package/lib/esm/checker.d.ts +1 -1
  50. package/lib/esm/checker.js +21 -16
  51. package/lib/esm/core.js +1 -1
  52. package/lib/esm/error.js +1 -3
  53. package/lib/esm/parser.d.ts +4 -61
  54. package/lib/esm/parser.js +320 -306
  55. package/lib/esm/scanner.d.ts +2 -13
  56. package/lib/esm/scanner.js +153 -152
  57. package/lib/esm/service/codeAction.d.ts +3 -3
  58. package/lib/esm/service/codeAction.js +26 -29
  59. package/lib/esm/service/colorProvider.d.ts +3 -3
  60. package/lib/esm/service/colorProvider.js +11 -21
  61. package/lib/esm/service/command/ChangeAllOtherEdgeOpsAndFixGraphCommand.d.ts +4 -4
  62. package/lib/esm/service/command/ChangeAllOtherEdgeOpsAndFixGraphCommand.js +4 -4
  63. package/lib/esm/service/command/ChangeEdgeOpCommand.d.ts +3 -3
  64. package/lib/esm/service/command/ChangeEdgeOpCommand.js +3 -5
  65. package/lib/esm/service/command/ConsolidateDescendantsCommand.d.ts +4 -4
  66. package/lib/esm/service/command/ConsolidateDescendantsCommand.js +11 -11
  67. package/lib/esm/service/command/RemoveSemicolons.d.ts +4 -4
  68. package/lib/esm/service/command/RemoveSemicolons.js +6 -8
  69. package/lib/esm/service/command/common.d.ts +4 -4
  70. package/lib/esm/service/command/common.js +7 -4
  71. package/lib/esm/service/completion.d.ts +2 -2
  72. package/lib/esm/service/completion.js +16 -16
  73. package/lib/esm/service/hover.d.ts +2 -2
  74. package/lib/esm/service/hover.js +8 -14
  75. package/lib/esm/service/languageFacts.js +1 -6
  76. package/lib/esm/service/reference.d.ts +2 -2
  77. package/lib/esm/service/reference.js +3 -6
  78. package/lib/esm/service/rename.d.ts +3 -3
  79. package/lib/esm/service/rename.js +9 -6
  80. package/lib/esm/service/service.d.ts +3 -3
  81. package/lib/esm/service/service.js +7 -7
  82. package/lib/esm/service/util.d.ts +1 -1
  83. package/lib/esm/service/util.js +5 -7
  84. package/lib/esm/service/validation.d.ts +3 -3
  85. package/lib/esm/service/validation.js +1 -1
  86. package/lib/esm/tester.js +1 -1
  87. package/lib/esm/visitor.d.ts +1 -1
  88. package/lib/esm/visitor.js +32 -33
  89. package/package.json +15 -10
@@ -1,6 +1,6 @@
1
1
  import type * as lst from "vscode-languageserver-types";
2
- import { DocumentLike, SourceFile, CommandApplication } from "../index.js";
3
- import { ExecutableCommand } from "./command/common.js";
2
+ import { type CommandApplication, type DocumentLike, type SourceFile } from "../index.js";
3
+ import { type ExecutableCommand } from "./command/common.js";
4
4
  export declare function getCodeActions(doc: DocumentLike, sourceFile: SourceFile, range: lst.Range, _context?: lst.CodeActionContext): lst.Command[] | undefined;
5
5
  export declare const enum CommandIds {
6
6
  ChangeEdgeOp = "DOT.changeEdgeOp",
@@ -9,4 +9,4 @@ export declare const enum CommandIds {
9
9
  RemoveSemicolons = "DOT.removeSemicolons"
10
10
  }
11
11
  export declare function getAvailableCommands(): string[];
12
- export declare function executeCommand(doc: DocumentLike, sourceFile: SourceFile, cmd: ExecutableCommand): CommandApplication | undefined;
12
+ export declare function executeCommand(doc: DocumentLike, sourceFile: SourceFile, cmd: ExecutableCommand<unknown[]>): CommandApplication | undefined;
@@ -15,23 +15,35 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
15
15
  }) : function(o, v) {
16
16
  o["default"] = v;
17
17
  });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
25
35
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.executeCommand = exports.getAvailableCommands = exports.getCodeActions = void 0;
27
- const index_js_1 = require("../index.js");
28
- const util_js_1 = require("./util.js");
36
+ exports.getCodeActions = getCodeActions;
37
+ exports.getAvailableCommands = getAvailableCommands;
38
+ exports.executeCommand = executeCommand;
29
39
  const checker_js_1 = require("../checker.js");
30
- const ChangeEdgeOpCommand = __importStar(require("./command/ChangeEdgeOpCommand.js"));
40
+ const index_js_1 = require("../index.js");
31
41
  const ChangeAllOtherEdgeOpsAndFixGraphCommand = __importStar(require("./command/ChangeAllOtherEdgeOpsAndFixGraphCommand.js"));
42
+ const ChangeEdgeOpCommand = __importStar(require("./command/ChangeEdgeOpCommand.js"));
32
43
  const ConsolidateDescendantsCommand = __importStar(require("./command/ConsolidateDescendantsCommand.js"));
33
44
  const RemoveSemicolonsCommand = __importStar(require("./command/RemoveSemicolons.js"));
34
45
  const common_js_1 = require("./command/common.js");
46
+ const util_js_1 = require("./util.js");
35
47
  function getCodeActions(doc, sourceFile, range, _context) {
36
48
  let actions = getActionsFromDiagnostics(doc, sourceFile, range);
37
49
  const general = getGeneralRefactorings(doc, sourceFile, range);
@@ -43,7 +55,6 @@ function getCodeActions(doc, sourceFile, range, _context) {
43
55
  }
44
56
  return actions;
45
57
  }
46
- exports.getCodeActions = getCodeActions;
47
58
  function getActionsFromDiagnostics(doc, file, range) {
48
59
  const ds = file.diagnostics;
49
60
  if (!ds || ds.length === 0)
@@ -88,10 +99,10 @@ function getGeneralRefactorings(doc, file, range) {
88
99
  }
89
100
  const clickedEdgeStatement = clickedNode.parent;
90
101
  if (clickedEdgeStatement && !subtreeContainsErrors(clickedEdgeStatement)) {
91
- if ((0, checker_js_1.isEdgeStatement)(clickedEdgeStatement)
92
- && clickedEdgeStatement.rhs.length === 1
93
- && (0, checker_js_1.isNodeId)(clickedEdgeStatement.source)
94
- && !(0, checker_js_1.edgeStatementHasAttributes)(clickedEdgeStatement)) {
102
+ if ((0, checker_js_1.isEdgeStatement)(clickedEdgeStatement) &&
103
+ clickedEdgeStatement.rhs.length === 1 &&
104
+ (0, checker_js_1.isNodeId)(clickedEdgeStatement.source) &&
105
+ !(0, checker_js_1.edgeStatementHasAttributes)(clickedEdgeStatement)) {
95
106
  candidates.push(clickedEdgeStatement);
96
107
  const source = clickedEdgeStatement.source;
97
108
  const sourceText = (0, checker_js_1.getIdentifierText)(source.id);
@@ -107,17 +118,17 @@ function getGeneralRefactorings(doc, file, range) {
107
118
  if (hasVisitedNodeModifier) {
108
119
  return;
109
120
  }
110
- else if (hasVisitedStatement) {
111
- if ((0, checker_js_1.isAttrStatement)(statement)
112
- || subtreeContainsErrors(statement)) {
121
+ if (hasVisitedStatement) {
122
+ if ((0, checker_js_1.isAttrStatement)(statement) ||
123
+ subtreeContainsErrors(statement)) {
113
124
  hasVisitedNodeModifier = true;
114
125
  return true;
115
126
  }
116
127
  }
117
128
  if (hasVisitedStatement) {
118
- if ((0, checker_js_1.isEdgeStatement)(statement)
119
- && statement.rhs.length === 1
120
- && !(0, checker_js_1.edgeStatementHasAttributes)(statement)) {
129
+ if ((0, checker_js_1.isEdgeStatement)(statement) &&
130
+ statement.rhs.length === 1 &&
131
+ !(0, checker_js_1.edgeStatementHasAttributes)(statement)) {
121
132
  const statementSource = statement.source;
122
133
  if ((0, checker_js_1.isNodeId)(statementSource)) {
123
134
  const lowerSourceText = (0, checker_js_1.getIdentifierText)(statementSource.id);
@@ -139,14 +150,17 @@ function getGeneralRefactorings(doc, file, range) {
139
150
  }
140
151
  }
141
152
  return res.length === 0 ? undefined : res;
142
- ;
143
153
  }
144
154
  function getCommandsForDiagnostic(doc, file, d) {
145
155
  switch (d.code.source) {
146
- case 1: return getScannerErrorCommand(doc, file, d, d.code);
147
- case 2: return getParserErrorCommand(doc, file, d, d.code);
148
- case 4: return getCheckerErrorCommand(doc, file, d, d.code);
149
- default: return (0, util_js_1.assertNever)(d.code);
156
+ case 1:
157
+ return getScannerErrorCommand(doc, file, d, d.code);
158
+ case 2:
159
+ return getParserErrorCommand(doc, file, d, d.code);
160
+ case 4:
161
+ return getCheckerErrorCommand(doc, file, d, d.code);
162
+ default:
163
+ return (0, util_js_1.assertNever)(d.code);
150
164
  }
151
165
  }
152
166
  function getScannerErrorCommand(_doc, _file, d, code) {
@@ -173,11 +187,7 @@ function getCheckerErrorCommand(_doc, file, d, code) {
173
187
  const fixSingleEdge = ChangeEdgeOpCommand.create(d.start, d.end, allowedOp, wrongOp);
174
188
  const fixAll = convertGraphTypeCommand(file, graph, kwk);
175
189
  const convertToThisWrongType = convertGraphTypeCommand(file, graph, (0, common_js_1.getOppositeKind)(kwk));
176
- return [
177
- fixSingleEdge,
178
- fixAll,
179
- convertToThisWrongType,
180
- ];
190
+ return [fixSingleEdge, fixAll, convertToThisWrongType];
181
191
  }
182
192
  case 1:
183
193
  return undefined;
@@ -190,11 +200,11 @@ function convertGraphTypeCommand(file, graph, changeToGraphType) {
190
200
  .filter(e => e.operation.kind !== changeToEdgeOp)
191
201
  .map(e => ({
192
202
  start: (0, util_js_1.getStart)(file, e.operation),
193
- end: e.operation.end
203
+ end: e.operation.end,
194
204
  }));
195
205
  const graphTypeOffset = {
196
206
  start: (0, util_js_1.getStart)(file, graph.keyword),
197
- end: graph.keyword.end
207
+ end: graph.keyword.end,
198
208
  };
199
209
  return ChangeAllOtherEdgeOpsAndFixGraphCommand.create(edgeOffsets, changeToEdgeOp, graphTypeOffset, graph.keyword.kind, changeToGraphType);
200
210
  }
@@ -214,14 +224,10 @@ const commandHandlers = {
214
224
  function getAvailableCommands() {
215
225
  return Object.keys(commandHandlers);
216
226
  }
217
- exports.getAvailableCommands = getAvailableCommands;
218
227
  function executeCommand(doc, sourceFile, cmd) {
219
228
  const handler = commandHandlers[cmd.command];
220
- return handler === undefined
221
- ? undefined
222
- : handler(doc, sourceFile, cmd);
229
+ return handler === undefined ? undefined : handler(doc, sourceFile, cmd);
223
230
  }
224
- exports.executeCommand = executeCommand;
225
231
  function subtreeContainsErrors(node) {
226
232
  if ((0, checker_js_1.nodeContainsErrors)(node))
227
233
  return true;
@@ -1,5 +1,5 @@
1
- import type { ColorInformation, ColorPresentation, Range, Color } from "vscode-languageserver-types";
2
- import { SourceFile } from "../types.js";
3
- import { DocumentLike } from "../index.js";
1
+ import type { Color, ColorInformation, ColorPresentation, Range } from "vscode-languageserver-types";
2
+ import type { DocumentLike } from "../index.js";
3
+ import type { SourceFile } from "../types.js";
4
4
  export declare function getDocumentColors(doc: DocumentLike, sourceFile: SourceFile): ColorInformation[] | undefined;
5
5
  export declare function getColorRepresentations(_doc: DocumentLike, _sourceFile: SourceFile, color: Color, range: Range): ColorPresentation[] | undefined;
@@ -15,31 +15,36 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
15
15
  }) : function(o, v) {
16
16
  o["default"] = v;
17
17
  });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
25
35
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.getColorRepresentations = exports.getDocumentColors = void 0;
27
- const util_js_1 = require("./util.js");
36
+ exports.getDocumentColors = getDocumentColors;
37
+ exports.getColorRepresentations = getColorRepresentations;
28
38
  const languageFacts = __importStar(require("./languageFacts.js"));
39
+ const util_js_1 = require("./util.js");
29
40
  const colorMap = languageFacts.colors;
30
41
  function getDocumentColors(doc, sourceFile) {
31
42
  const cs = sourceFile.colors;
32
- return cs
33
- ? colorTableToColorInformation(doc, sourceFile, cs)
34
- : undefined;
43
+ return cs ? colorTableToColorInformation(doc, sourceFile, cs) : undefined;
35
44
  }
36
- exports.getDocumentColors = getDocumentColors;
37
45
  function getColorRepresentations(_doc, _sourceFile, color, range) {
38
- return !color || !range
39
- ? undefined
40
- : [{ label: '"' + getColorStringFromColor(color) + '"', }];
46
+ return !color || !range ? undefined : [{ label: `"${getColorStringFromColor(color)}"` }];
41
47
  }
42
- exports.getColorRepresentations = getColorRepresentations;
43
48
  function colorTableToColorInformation(doc, sf, colors) {
44
49
  if (!colors || colors.size === 0)
45
50
  return [];
@@ -61,32 +66,26 @@ function getColorFromName(name) {
61
66
  if (name.charAt(0) === "#")
62
67
  return getHexCodeColor(name);
63
68
  const colorAlias = colorMap[name.toLowerCase()];
64
- return colorAlias
65
- ? getHexCodeColor(colorAlias)
66
- : undefined;
69
+ return colorAlias ? getHexCodeColor(colorAlias) : undefined;
67
70
  }
68
71
  function getHexCodeColor(colorCode) {
69
- const hexCode = colorCode.charAt(0) === "#"
70
- ? colorCode.substring(1)
71
- : colorCode;
72
- const colorInt = parseInt(hexCode, 16);
72
+ const hexCode = colorCode.charAt(0) === "#" ? colorCode.substring(1) : colorCode;
73
+ const colorInt = Number.parseInt(hexCode, 16);
73
74
  return {
74
- red: (colorInt >> 16 & 0xff) / 255.0,
75
- green: (colorInt >> 8 & 0xff) / 255.0,
75
+ red: ((colorInt >> 16) & 0xff) / 255.0,
76
+ green: ((colorInt >> 8) & 0xff) / 255.0,
76
77
  blue: (colorInt & 0xff) / 255.0,
77
- alpha: hexCode.length === 8 ? (colorInt >> 24 & 0xff) / 255.0 : 1.0,
78
+ alpha: hexCode.length === 8 ? ((colorInt >> 24) & 0xff) / 255.0 : 1.0,
78
79
  };
79
80
  }
80
81
  function getColorStringFromColor(c) {
81
82
  const red = (c.red * 255) | 0;
82
83
  const green = (c.green * 255) | 0;
83
84
  const blue = (c.blue * 255) | 0;
84
- return "#" + numberToPaddedString(red) + numberToPaddedString(green) + numberToPaddedString(blue);
85
+ return `#${numberToPaddedString(red)}${numberToPaddedString(green)}${numberToPaddedString(blue)}`;
85
86
  }
86
87
  function numberToPaddedString(n) {
87
88
  const s = n.toString(16);
88
- return (s.length === 1
89
- ? "0" + s
90
- : s).toLowerCase();
89
+ return (s.length === 1 ? `0${s}` : s).toLowerCase();
91
90
  }
92
91
  //# sourceMappingURL=colorProvider.js.map
@@ -1,10 +1,10 @@
1
- import * as lst from "vscode-languageserver-types";
1
+ import type * as lst from "vscode-languageserver-types";
2
+ import type { CommandApplication, DocumentLike, SourceFile } from "../../index.js";
2
3
  import { CommandIds } from "../codeAction.js";
3
- import { GraphTypeStr, Offset, EdgeOpStr, ExecutableCommand, EdgeType, GraphType } from "./common.js";
4
- import { DocumentLike, SourceFile, CommandApplication } from "../../index.js";
4
+ import { type EdgeOpStr, type EdgeType, type ExecutableCommand, type GraphType, type GraphTypeStr, type Offset } from "./common.js";
5
5
  export interface ChangeAllOtherEdgeOpsAndFixGraphCommand extends lst.Command {
6
6
  command: CommandIds.ConvertGraphType;
7
7
  arguments: [Offset[], EdgeOpStr, Offset, GraphTypeStr];
8
8
  }
9
9
  export declare function create(edgeOffsets: Offset[], changeEdgesTo: EdgeType, graphOffset: Offset, changeFromGraph: GraphType, changeGraphTo: GraphType): ChangeAllOtherEdgeOpsAndFixGraphCommand;
10
- export declare function execute(doc: DocumentLike, _sourceFile: SourceFile, cmd: ExecutableCommand): CommandApplication | undefined;
10
+ export declare function execute(doc: DocumentLike, _sourceFile: SourceFile, cmd: ExecutableCommand<unknown[]>): CommandApplication | undefined;
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.execute = exports.create = void 0;
3
+ exports.create = create;
4
+ exports.execute = execute;
4
5
  const common_js_1 = require("./common.js");
5
6
  function create(edgeOffsets, changeEdgesTo, graphOffset, changeFromGraph, changeGraphTo) {
6
7
  const toGraph = (0, common_js_1.getGraphKeywordStr)(changeGraphTo);
@@ -14,7 +15,6 @@ function create(edgeOffsets, changeEdgesTo, graphOffset, changeFromGraph, change
14
15
  arguments: [edgeOffsets, edgeStr, graphOffset, toGraph],
15
16
  };
16
17
  }
17
- exports.create = create;
18
18
  function execute(doc, _sourceFile, cmd) {
19
19
  if (!isChangeAllOtherEdgeOpsAndFixGraphCommand(cmd))
20
20
  return undefined;
@@ -32,12 +32,11 @@ function execute(doc, _sourceFile, cmd) {
32
32
  edit: {
33
33
  changes: {
34
34
  [doc.uri]: edits,
35
- }
36
- }
35
+ },
36
+ },
37
37
  };
38
38
  }
39
- exports.execute = execute;
40
39
  function isChangeAllOtherEdgeOpsAndFixGraphCommand(cmd) {
41
- return cmd.command === "DOT.convertGraphType" && !!cmd.arguments && cmd.arguments.length === 4;
40
+ return (cmd.command === "DOT.convertGraphType" && !!cmd.arguments && cmd.arguments.length === 4);
42
41
  }
43
42
  //# sourceMappingURL=ChangeAllOtherEdgeOpsAndFixGraphCommand.js.map
@@ -1,10 +1,10 @@
1
1
  import * as lst from "vscode-languageserver-types";
2
+ import type { CommandApplication, DocumentLike, SourceFile } from "../../index.js";
2
3
  import { CommandIds } from "../codeAction.js";
3
- import { EdgeOpStr, ExecutableCommand, EdgeType } from "./common.js";
4
- import { DocumentLike, SourceFile, CommandApplication } from "../../index.js";
4
+ import { type EdgeOpStr, type EdgeType, type ExecutableCommand } from "./common.js";
5
5
  export interface ChangeEdgeOpCommand extends lst.Command {
6
6
  command: CommandIds.ChangeEdgeOp;
7
7
  arguments: [number, number, EdgeOpStr];
8
8
  }
9
9
  export declare function create(startOffset: number, endOffset: number, changeTo: EdgeType, changeFrom: EdgeType): ChangeEdgeOpCommand;
10
- export declare function execute(doc: DocumentLike, _sourceFile: SourceFile, cmd: ExecutableCommand): CommandApplication | undefined;
10
+ export declare function execute(doc: DocumentLike, _sourceFile: SourceFile, cmd: ExecutableCommand<unknown[]>): CommandApplication | undefined;
@@ -15,15 +15,26 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
15
15
  }) : function(o, v) {
16
16
  o["default"] = v;
17
17
  });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
25
35
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.execute = exports.create = void 0;
36
+ exports.create = create;
37
+ exports.execute = execute;
27
38
  const lst = __importStar(require("vscode-languageserver-types"));
28
39
  const common_js_1 = require("./common.js");
29
40
  function create(startOffset, endOffset, changeTo, changeFrom) {
@@ -35,7 +46,6 @@ function create(startOffset, endOffset, changeTo, changeFrom) {
35
46
  arguments: [startOffset, endOffset, to],
36
47
  };
37
48
  }
38
- exports.create = create;
39
49
  function execute(doc, _sourceFile, cmd) {
40
50
  if (!isChangeEdgeOpCommand(cmd))
41
51
  return undefined;
@@ -46,14 +56,11 @@ function execute(doc, _sourceFile, cmd) {
46
56
  label: `Change of invalid edge to "${changeTo}"'"`,
47
57
  edit: {
48
58
  changes: {
49
- [doc.uri]: [
50
- lst.TextEdit.replace(lst.Range.create(startPos, endPos), changeTo),
51
- ],
52
- }
53
- }
59
+ [doc.uri]: [lst.TextEdit.replace(lst.Range.create(startPos, endPos), changeTo)],
60
+ },
61
+ },
54
62
  };
55
63
  }
56
- exports.execute = execute;
57
64
  function isChangeEdgeOpCommand(cmd) {
58
65
  return cmd.command === "DOT.changeEdgeOp" && !!cmd.arguments && cmd.arguments.length === 3;
59
66
  }
@@ -1,10 +1,10 @@
1
- import * as lst from "vscode-languageserver-types";
1
+ import type * as lst from "vscode-languageserver-types";
2
+ import type { CommandApplication, DocumentLike, EdgeStatement, SourceFile } from "../../index.js";
2
3
  import { CommandIds } from "../codeAction.js";
3
- import { ExecutableCommand } from "./common.js";
4
- import { DocumentLike, SourceFile, CommandApplication, EdgeStatement } from "../../index.js";
4
+ import type { ExecutableCommand } from "./common.js";
5
5
  export interface ConsolidateDescendantsCommand extends lst.Command {
6
6
  command: CommandIds.ConsolidateDescendants;
7
7
  arguments: number[];
8
8
  }
9
9
  export declare function create(statements: EdgeStatement[], below: boolean): ConsolidateDescendantsCommand;
10
- export declare function execute(doc: DocumentLike, sourceFile: SourceFile, cmd: ExecutableCommand): CommandApplication | undefined;
10
+ export declare function execute(doc: DocumentLike, sourceFile: SourceFile, cmd: ExecutableCommand<unknown[]>): CommandApplication | undefined;
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.execute = exports.create = void 0;
3
+ exports.create = create;
4
+ exports.execute = execute;
4
5
  const checker_js_1 = require("../../checker.js");
5
6
  const util_js_1 = require("../util.js");
6
7
  function create(statements, below) {
@@ -15,7 +16,6 @@ function create(statements, below) {
15
16
  arguments: statements.map(s => s.pos),
16
17
  };
17
18
  }
18
- exports.create = create;
19
19
  function execute(doc, sourceFile, cmd) {
20
20
  if (!isConsolidateDescendantsCommand(cmd))
21
21
  return undefined;
@@ -30,9 +30,7 @@ function execute(doc, sourceFile, cmd) {
30
30
  const firstRight = first.rhs[0];
31
31
  const firstRightTargetStart = (0, util_js_1.getStart)(sourceFile, firstRight.target);
32
32
  const firstRightTargetEnd = firstRight.target.end;
33
- const contents = [
34
- sourceFile.content.substring(firstRightTargetStart, firstRightTargetEnd)
35
- ];
33
+ const contents = [sourceFile.content.substring(firstRightTargetStart, firstRightTargetEnd)];
36
34
  for (const descendant of candidates) {
37
35
  const rightItem = descendant.rhs[0];
38
36
  const rightItemTarget = rightItem.target;
@@ -44,14 +42,14 @@ function execute(doc, sourceFile, cmd) {
44
42
  range: {
45
43
  start: doc.positionAt(descendant.pos),
46
44
  end: doc.positionAt(rightItemTargetStart),
47
- }
45
+ },
48
46
  });
49
47
  edits.push({
50
48
  newText: "",
51
49
  range: {
52
50
  start: doc.positionAt(rightItemTargetStart),
53
51
  end: doc.positionAt(rightItemTargetEnd),
54
- }
52
+ },
55
53
  });
56
54
  if (descendant.terminator !== undefined) {
57
55
  edits.push({
@@ -59,7 +57,7 @@ function execute(doc, sourceFile, cmd) {
59
57
  range: {
60
58
  start: doc.positionAt((0, util_js_1.getStart)(sourceFile, descendant.terminator)),
61
59
  end: doc.positionAt(descendant.terminator.end),
62
- }
60
+ },
63
61
  });
64
62
  }
65
63
  contents.push(rightItemContent);
@@ -70,19 +68,20 @@ function execute(doc, sourceFile, cmd) {
70
68
  range: {
71
69
  start: doc.positionAt(firstRightTargetStart),
72
70
  end: doc.positionAt(firstRightTargetEnd),
73
- }
71
+ },
74
72
  });
75
73
  return {
76
74
  label: `Convert edges from "${from}" to subgraph.`,
77
75
  edit: {
78
76
  changes: {
79
77
  [doc.uri]: edits,
80
- }
81
- }
78
+ },
79
+ },
82
80
  };
83
81
  }
84
- exports.execute = execute;
85
82
  function isConsolidateDescendantsCommand(cmd) {
86
- return cmd.command === "DOT.consolidateDescendants" && !!cmd.arguments && cmd.arguments.length > 1;
83
+ return (cmd.command === "DOT.consolidateDescendants" &&
84
+ !!cmd.arguments &&
85
+ cmd.arguments.length > 1);
87
86
  }
88
87
  //# sourceMappingURL=ConsolidateDescendantsCommand.js.map
@@ -1,10 +1,10 @@
1
- import * as lst from "vscode-languageserver-types";
1
+ import type * as lst from "vscode-languageserver-types";
2
+ import type { CommandApplication, DocumentLike, SourceFile } from "../../index.js";
2
3
  import { CommandIds } from "../codeAction.js";
3
- import { ExecutableCommand } from "./common.js";
4
- import { DocumentLike, SourceFile, CommandApplication } from "../../index.js";
4
+ import { type ExecutableCommand } from "./common.js";
5
5
  export interface RemoveSemicolonsCommand extends lst.Command {
6
6
  command: CommandIds.RemoveSemicolons;
7
7
  arguments: undefined;
8
8
  }
9
9
  export declare function create(): RemoveSemicolonsCommand;
10
- export declare function execute(doc: DocumentLike, sourceFile: SourceFile, cmd: ExecutableCommand): CommandApplication | undefined;
10
+ export declare function execute(doc: DocumentLike, sourceFile: SourceFile, cmd: ExecutableCommand<unknown[]>): CommandApplication | undefined;
@@ -1,8 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.execute = exports.create = void 0;
4
- const common_js_1 = require("./common.js");
3
+ exports.create = create;
4
+ exports.execute = execute;
5
5
  const checker_js_1 = require("../../checker.js");
6
+ const common_js_1 = require("./common.js");
6
7
  function create() {
7
8
  return {
8
9
  title: "Remove optional semicolons",
@@ -10,7 +11,6 @@ function create() {
10
11
  arguments: undefined,
11
12
  };
12
13
  }
13
- exports.create = create;
14
14
  function execute(doc, sourceFile, cmd) {
15
15
  if (!isRemoveSemicolonsCommand(cmd))
16
16
  return undefined;
@@ -24,19 +24,16 @@ function execute(doc, sourceFile, cmd) {
24
24
  return (0, common_js_1.createChangeToEdit)(doc.positionAt(start), doc.positionAt(end), "");
25
25
  });
26
26
  return {
27
- label: `Remove optional semicolons`,
27
+ label: "Remove optional semicolons",
28
28
  edit: {
29
29
  changes: {
30
30
  [doc.uri]: edits,
31
- }
32
- }
31
+ },
32
+ },
33
33
  };
34
34
  }
35
- exports.execute = execute;
36
35
  function isRemoveSemicolonsCommand(cmd) {
37
- return cmd.command === "DOT.removeSemicolons"
38
- && (!cmd.arguments
39
- || cmd.arguments.length === 0
40
- || cmd.arguments.every(e => e === undefined));
36
+ return (cmd.command === "DOT.removeSemicolons" &&
37
+ (!cmd.arguments || cmd.arguments.length === 0 || cmd.arguments.every(e => e === undefined)));
41
38
  }
42
39
  //# sourceMappingURL=RemoveSemicolons.js.map
@@ -1,14 +1,14 @@
1
- import { TextEdit, type Position } from "vscode-languageserver-types";
1
+ import { type Position, TextEdit } from "vscode-languageserver-types";
2
2
  import { SyntaxKind } from "../../index.js";
3
- import { CommandIds } from "../codeAction.js";
3
+ import type { CommandIds } from "../codeAction.js";
4
4
  export declare function createChangeToEdit(start: Position, end: Position, changeTo: string): TextEdit;
5
5
  export interface Offset {
6
6
  start: number;
7
7
  end: number;
8
8
  }
9
- export type ExecutableCommand = {
9
+ export type ExecutableCommand<TArgs> = {
10
10
  command: CommandIds;
11
- arguments?: any[];
11
+ arguments?: TArgs;
12
12
  };
13
13
  export type EdgeOpStr = "--" | "->";
14
14
  export declare function getEdgeStr(op: SyntaxKind.UndirectedEdgeOp): "--";
@@ -1,31 +1,33 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getAllowedOp = exports.getOppositeEdgeOp = exports.getOppositeKind = exports.getGraphKeywordStr = exports.getEdgeStr = exports.createChangeToEdit = void 0;
3
+ exports.createChangeToEdit = createChangeToEdit;
4
+ exports.getEdgeStr = getEdgeStr;
5
+ exports.getGraphKeywordStr = getGraphKeywordStr;
6
+ exports.getOppositeKind = getOppositeKind;
7
+ exports.getOppositeEdgeOp = getOppositeEdgeOp;
8
+ exports.getAllowedOp = getAllowedOp;
4
9
  const vscode_languageserver_types_1 = require("vscode-languageserver-types");
5
10
  const index_js_1 = require("../../index.js");
6
11
  function createChangeToEdit(start, end, changeTo) {
7
12
  return vscode_languageserver_types_1.TextEdit.replace(vscode_languageserver_types_1.Range.create(start, end), changeTo);
8
13
  }
9
- exports.createChangeToEdit = createChangeToEdit;
10
- ;
11
14
  function getEdgeStr(op) {
12
15
  return op === index_js_1.SyntaxKind.DirectedEdgeOp ? "->" : "--";
13
16
  }
14
- exports.getEdgeStr = getEdgeStr;
15
17
  function getGraphKeywordStr(g) {
16
18
  return g === index_js_1.SyntaxKind.DigraphKeyword ? "digraph" : "graph";
17
19
  }
18
- exports.getGraphKeywordStr = getGraphKeywordStr;
19
20
  function getOppositeKind(g) {
20
21
  return g === index_js_1.SyntaxKind.DigraphKeyword ? index_js_1.SyntaxKind.GraphKeyword : index_js_1.SyntaxKind.DigraphKeyword;
21
22
  }
22
- exports.getOppositeKind = getOppositeKind;
23
23
  function getOppositeEdgeOp(g) {
24
- return g === index_js_1.SyntaxKind.DirectedEdgeOp ? index_js_1.SyntaxKind.UndirectedEdgeOp : index_js_1.SyntaxKind.DirectedEdgeOp;
24
+ return g === index_js_1.SyntaxKind.DirectedEdgeOp
25
+ ? index_js_1.SyntaxKind.UndirectedEdgeOp
26
+ : index_js_1.SyntaxKind.DirectedEdgeOp;
25
27
  }
26
- exports.getOppositeEdgeOp = getOppositeEdgeOp;
27
28
  function getAllowedOp(g) {
28
- return g === index_js_1.SyntaxKind.DigraphKeyword ? index_js_1.SyntaxKind.DirectedEdgeOp : index_js_1.SyntaxKind.UndirectedEdgeOp;
29
+ return g === index_js_1.SyntaxKind.DigraphKeyword
30
+ ? index_js_1.SyntaxKind.DirectedEdgeOp
31
+ : index_js_1.SyntaxKind.UndirectedEdgeOp;
29
32
  }
30
- exports.getAllowedOp = getAllowedOp;
31
33
  //# sourceMappingURL=common.js.map
@@ -1,4 +1,4 @@
1
1
  import * as lst from "vscode-languageserver-types";
2
- import { SourceFile } from "../types.js";
3
- import { DocumentLike } from "../index.js";
2
+ import { type DocumentLike } from "../index.js";
3
+ import { type SourceFile } from "../types.js";
4
4
  export declare function getCompletions(doc: DocumentLike, sourceFile: SourceFile, position: lst.Position): lst.CompletionItem[];