dot-language-support 1.6.0 → 1.7.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/lib/error.d.ts +1 -1
- package/lib/index.d.ts +0 -1
- package/lib/index.js +0 -1
- package/lib/parser.d.ts +1 -1
- package/lib/parser.js +5 -3
- package/lib/service/codeAction.d.ts +2 -2
- package/lib/service/codeAction.js +31 -8
- package/lib/service/colorProvider.d.ts +2 -2
- package/lib/service/colorProvider.js +25 -2
- package/lib/service/command/ChangeAllOtherEdgeOpsAndFixGraphCommand.d.ts +1 -1
- package/lib/service/command/ChangeAllOtherEdgeOpsAndFixGraphCommand.js +1 -1
- package/lib/service/command/ChangeEdgeOpCommand.d.ts +1 -1
- package/lib/service/command/ChangeEdgeOpCommand.js +25 -2
- package/lib/service/command/ConsolidateDescendantsCommand.js +0 -18
- package/lib/service/command/common.d.ts +2 -2
- package/lib/service/command/common.js +2 -2
- package/lib/service/completion.js +25 -2
- package/lib/service/hover.d.ts +1 -1
- package/lib/service/polyfill.d.ts +4 -4
- package/lib/service/reference.d.ts +5 -5
- package/lib/service/reference.js +0 -2
- package/lib/service/rename.d.ts +2 -2
- package/lib/service/rename.js +2 -2
- package/lib/service/service.d.ts +3 -2
- package/lib/service/util.d.ts +6 -6
- package/lib/service/util.js +2 -2
- package/package.json +7 -7
- package/lib/service/interop.d.ts +0 -15
- package/lib/service/interop.js +0 -56
package/lib/error.d.ts
CHANGED
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
|
@@ -19,5 +19,4 @@ __exportStar(require("./scanner"), exports);
|
|
|
19
19
|
__exportStar(require("./parser"), exports);
|
|
20
20
|
__exportStar(require("./visitor"), exports);
|
|
21
21
|
__exportStar(require("./service/service"), exports);
|
|
22
|
-
__exportStar(require("./service/interop"), exports);
|
|
23
22
|
//# sourceMappingURL=index.js.map
|
package/lib/parser.d.ts
CHANGED
|
@@ -81,4 +81,4 @@ export declare class Parser {
|
|
|
81
81
|
private tryParse;
|
|
82
82
|
}
|
|
83
83
|
export declare function isIdentifier(kind: SyntaxKind): boolean;
|
|
84
|
-
export declare function isIdentifierNode
|
|
84
|
+
export declare function isIdentifierNode(node: SyntaxNode): node is Identifier;
|
package/lib/parser.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.isIdentifierNode = exports.isIdentifier = exports.Parser = exports.ParsingContext = void 0;
|
|
4
4
|
const scanner_1 = require("./scanner");
|
|
5
|
+
const util_1 = require("./service/util");
|
|
5
6
|
const types_1 = require("./types");
|
|
6
7
|
var ParsingContext;
|
|
7
8
|
(function (ParsingContext) {
|
|
@@ -425,8 +426,9 @@ class Parser {
|
|
|
425
426
|
return "Wat, no parsing context";
|
|
426
427
|
case ParsingContext.Count:
|
|
427
428
|
return "Wat, 'Count' parsing context";
|
|
429
|
+
default:
|
|
430
|
+
return (0, util_1.assertNever)(context);
|
|
428
431
|
}
|
|
429
|
-
return "Error parsing list";
|
|
430
432
|
}
|
|
431
433
|
isInSomeParsingContext() {
|
|
432
434
|
for (let ctx = 0; ctx < ParsingContext.Count; ctx++) {
|
|
@@ -446,7 +448,7 @@ class Parser {
|
|
|
446
448
|
this.nextToken();
|
|
447
449
|
return false;
|
|
448
450
|
}
|
|
449
|
-
isListElement(context,
|
|
451
|
+
isListElement(context, _inErrorRecovery) {
|
|
450
452
|
switch (context) {
|
|
451
453
|
case ParsingContext.AssignmentList:
|
|
452
454
|
return this.isIdentifier();
|
|
@@ -544,7 +546,7 @@ class Parser {
|
|
|
544
546
|
};
|
|
545
547
|
return this.parseErrorAtPosition(this.scanner.tokenPos, this.scanner.pos, message, error);
|
|
546
548
|
}
|
|
547
|
-
scanError(message,
|
|
549
|
+
scanError(message, _category, sub, length) {
|
|
548
550
|
const errorPos = this.scanner.pos;
|
|
549
551
|
const err = {
|
|
550
552
|
source: 1,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import * as lst from "vscode-languageserver-types";
|
|
1
|
+
import type * as lst from "vscode-languageserver-types";
|
|
2
2
|
import { DocumentLike, SourceFile, CommandApplication } from "../";
|
|
3
3
|
import { ExecutableCommand } from "./command/common";
|
|
4
|
-
export declare function getCodeActions(doc: DocumentLike, sourceFile: SourceFile, range: lst.Range,
|
|
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",
|
|
7
7
|
ConvertGraphType = "DOT.convertGraphType",
|
|
@@ -1,15 +1,38 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
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
|
+
};
|
|
2
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
26
|
exports.executeCommand = exports.getAvailableCommands = exports.getCodeActions = void 0;
|
|
4
27
|
const __1 = require("../");
|
|
5
28
|
const util_1 = require("./util");
|
|
6
29
|
const checker_1 = require("../checker");
|
|
7
|
-
const ChangeEdgeOpCommand = require("./command/ChangeEdgeOpCommand");
|
|
8
|
-
const ChangeAllOtherEdgeOpsAndFixGraphCommand = require("./command/ChangeAllOtherEdgeOpsAndFixGraphCommand");
|
|
9
|
-
const ConsolidateDescendantsCommand = require("./command/ConsolidateDescendantsCommand");
|
|
10
|
-
const RemoveSemicolonsCommand = require("./command/RemoveSemicolons");
|
|
30
|
+
const ChangeEdgeOpCommand = __importStar(require("./command/ChangeEdgeOpCommand"));
|
|
31
|
+
const ChangeAllOtherEdgeOpsAndFixGraphCommand = __importStar(require("./command/ChangeAllOtherEdgeOpsAndFixGraphCommand"));
|
|
32
|
+
const ConsolidateDescendantsCommand = __importStar(require("./command/ConsolidateDescendantsCommand"));
|
|
33
|
+
const RemoveSemicolonsCommand = __importStar(require("./command/RemoveSemicolons"));
|
|
11
34
|
const common_1 = require("./command/common");
|
|
12
|
-
function getCodeActions(doc, sourceFile, range,
|
|
35
|
+
function getCodeActions(doc, sourceFile, range, _context) {
|
|
13
36
|
let actions = getActionsFromDiagnostics(doc, sourceFile, range);
|
|
14
37
|
const general = getGeneralRefactorings(doc, sourceFile, range);
|
|
15
38
|
if (general) {
|
|
@@ -126,17 +149,17 @@ function getCommandsForDiagnostic(doc, file, d) {
|
|
|
126
149
|
default: return (0, util_1.assertNever)(d.code);
|
|
127
150
|
}
|
|
128
151
|
}
|
|
129
|
-
function getScannerErrorCommand(
|
|
152
|
+
function getScannerErrorCommand(_doc, _file, d, code) {
|
|
130
153
|
console.assert(d.code.source === 1);
|
|
131
154
|
console.assert(code.source === 1);
|
|
132
155
|
return undefined;
|
|
133
156
|
}
|
|
134
|
-
function getParserErrorCommand(
|
|
157
|
+
function getParserErrorCommand(_doc, _file, d, code) {
|
|
135
158
|
console.assert(d.code.source === 2);
|
|
136
159
|
console.assert(code.source === 2);
|
|
137
160
|
return undefined;
|
|
138
161
|
}
|
|
139
|
-
function getCheckerErrorCommand(
|
|
162
|
+
function getCheckerErrorCommand(_doc, file, d, code) {
|
|
140
163
|
console.assert(d.code.source === 4);
|
|
141
164
|
console.assert(code.source === 4);
|
|
142
165
|
switch (code.sub) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import * as lst from "vscode-languageserver-types";
|
|
1
|
+
import type * as lst from "vscode-languageserver-types";
|
|
2
2
|
import { ColorInformation, Color, ColorPresentation } from "./polyfill";
|
|
3
3
|
import { SourceFile } from "../types";
|
|
4
4
|
import { DocumentLike } from "../";
|
|
5
5
|
export declare function getDocumentColors(doc: DocumentLike, sourceFile: SourceFile): ColorInformation[] | undefined;
|
|
6
|
-
export declare function getColorRepresentations(
|
|
6
|
+
export declare function getColorRepresentations(_doc: DocumentLike, _sourceFile: SourceFile, color: Color, range: lst.Range): ColorPresentation[] | undefined;
|
|
@@ -1,8 +1,31 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
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
|
+
};
|
|
2
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
26
|
exports.getColorRepresentations = exports.getDocumentColors = void 0;
|
|
4
27
|
const util_1 = require("./util");
|
|
5
|
-
const languageFacts = require("./languageFacts");
|
|
28
|
+
const languageFacts = __importStar(require("./languageFacts"));
|
|
6
29
|
const colorMap = languageFacts.colors;
|
|
7
30
|
function getDocumentColors(doc, sourceFile) {
|
|
8
31
|
const cs = sourceFile.colors;
|
|
@@ -11,7 +34,7 @@ function getDocumentColors(doc, sourceFile) {
|
|
|
11
34
|
: undefined;
|
|
12
35
|
}
|
|
13
36
|
exports.getDocumentColors = getDocumentColors;
|
|
14
|
-
function getColorRepresentations(
|
|
37
|
+
function getColorRepresentations(_doc, _sourceFile, color, range) {
|
|
15
38
|
if (!color || !range)
|
|
16
39
|
return undefined;
|
|
17
40
|
const hexColor = getColorStringFromColor(color);
|
|
@@ -7,4 +7,4 @@ export interface ChangeAllOtherEdgeOpsAndFixGraphCommand extends lst.Command {
|
|
|
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,
|
|
10
|
+
export declare function execute(doc: DocumentLike, _sourceFile: SourceFile, cmd: ExecutableCommand): CommandApplication | undefined;
|
|
@@ -15,7 +15,7 @@ function create(edgeOffsets, changeEdgesTo, graphOffset, changeFromGraph, change
|
|
|
15
15
|
};
|
|
16
16
|
}
|
|
17
17
|
exports.create = create;
|
|
18
|
-
function execute(doc,
|
|
18
|
+
function execute(doc, _sourceFile, cmd) {
|
|
19
19
|
if (!isChangeAllOtherEdgeOpsAndFixGraphCommand(cmd))
|
|
20
20
|
return undefined;
|
|
21
21
|
const [edgeOffsets, changeEdgeTo, graphOffset, changeGraphTo] = cmd.arguments;
|
|
@@ -7,4 +7,4 @@ export interface ChangeEdgeOpCommand extends lst.Command {
|
|
|
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,
|
|
10
|
+
export declare function execute(doc: DocumentLike, _sourceFile: SourceFile, cmd: ExecutableCommand): CommandApplication | undefined;
|
|
@@ -1,7 +1,30 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
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
|
+
};
|
|
2
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
26
|
exports.execute = exports.create = void 0;
|
|
4
|
-
const lst = require("vscode-languageserver-types");
|
|
27
|
+
const lst = __importStar(require("vscode-languageserver-types"));
|
|
5
28
|
const common_1 = require("./common");
|
|
6
29
|
function create(startOffset, endOffset, changeTo, changeFrom) {
|
|
7
30
|
const from = (0, common_1.getEdgeStr)(changeFrom);
|
|
@@ -13,7 +36,7 @@ function create(startOffset, endOffset, changeTo, changeFrom) {
|
|
|
13
36
|
};
|
|
14
37
|
}
|
|
15
38
|
exports.create = create;
|
|
16
|
-
function execute(doc,
|
|
39
|
+
function execute(doc, _sourceFile, cmd) {
|
|
17
40
|
if (!isChangeEdgeOpCommand(cmd))
|
|
18
41
|
return undefined;
|
|
19
42
|
const [startOffset, endOffset, changeTo] = cmd.arguments;
|
|
@@ -1,15 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
-
var t = {};
|
|
4
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
-
t[p] = s[p];
|
|
6
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
-
t[p[i]] = s[p[i]];
|
|
10
|
-
}
|
|
11
|
-
return t;
|
|
12
|
-
};
|
|
13
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
3
|
exports.execute = exports.create = void 0;
|
|
15
4
|
const checker_1 = require("../../checker");
|
|
@@ -27,13 +16,6 @@ function create(statements, below) {
|
|
|
27
16
|
};
|
|
28
17
|
}
|
|
29
18
|
exports.create = create;
|
|
30
|
-
function unbind(statements) {
|
|
31
|
-
const res = [];
|
|
32
|
-
for (const statement of statements) {
|
|
33
|
-
const { parent } = statement, copy = __rest(statement, ["parent"]);
|
|
34
|
-
}
|
|
35
|
-
return res;
|
|
36
|
-
}
|
|
37
19
|
function execute(doc, sourceFile, cmd) {
|
|
38
20
|
if (!isConsolidateDescendantsCommand(cmd))
|
|
39
21
|
return undefined;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { TextEdit, type Position } from "vscode-languageserver-types";
|
|
2
2
|
import { SyntaxKind } from "../../";
|
|
3
3
|
import { CommandIds } from "../codeAction";
|
|
4
|
-
export declare function createChangeToEdit(start:
|
|
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;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getAllowedOp = exports.getOppositeEdgeOp = exports.getOppositeKind = exports.getGraphKeywordStr = exports.getEdgeStr = exports.createChangeToEdit = void 0;
|
|
4
|
-
const
|
|
4
|
+
const vscode_languageserver_types_1 = require("vscode-languageserver-types");
|
|
5
5
|
const __1 = require("../../");
|
|
6
6
|
function createChangeToEdit(start, end, changeTo) {
|
|
7
|
-
return
|
|
7
|
+
return vscode_languageserver_types_1.TextEdit.replace(vscode_languageserver_types_1.Range.create(start, end), changeTo);
|
|
8
8
|
}
|
|
9
9
|
exports.createChangeToEdit = createChangeToEdit;
|
|
10
10
|
;
|
|
@@ -1,12 +1,35 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
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
|
+
};
|
|
2
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
26
|
exports.getCompletions = void 0;
|
|
4
|
-
const lst = require("vscode-languageserver-types");
|
|
27
|
+
const lst = __importStar(require("vscode-languageserver-types"));
|
|
5
28
|
const types_1 = require("../types");
|
|
6
29
|
const checker_1 = require("../checker");
|
|
7
30
|
const util_1 = require("./util");
|
|
8
31
|
const __1 = require("../");
|
|
9
|
-
const languageFacts = require("./languageFacts");
|
|
32
|
+
const languageFacts = __importStar(require("./languageFacts"));
|
|
10
33
|
function getCompletions(doc, sourceFile, position) {
|
|
11
34
|
const symbols = sourceFile.symbols;
|
|
12
35
|
if (!symbols)
|
package/lib/service/hover.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as lst from "vscode-languageserver-types";
|
|
1
|
+
import type * as lst from "vscode-languageserver-types";
|
|
2
2
|
import { SourceFile } from "../types";
|
|
3
3
|
import { DocumentLike } from "../";
|
|
4
4
|
export declare function hover(doc: DocumentLike, sourceFile: SourceFile, position: lst.Position): lst.Hover | undefined;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import type { Range, TextEdit } from "vscode-languageserver-types";
|
|
2
2
|
export interface ColorInformation {
|
|
3
|
-
range:
|
|
3
|
+
range: Range;
|
|
4
4
|
color: Color;
|
|
5
5
|
}
|
|
6
6
|
export interface Color {
|
|
@@ -11,6 +11,6 @@ export interface Color {
|
|
|
11
11
|
}
|
|
12
12
|
export interface ColorPresentation {
|
|
13
13
|
label: string;
|
|
14
|
-
textEdit?:
|
|
15
|
-
additionalTextEdits?:
|
|
14
|
+
textEdit?: TextEdit;
|
|
15
|
+
additionalTextEdits?: TextEdit[];
|
|
16
16
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { SourceFile } from "../types";
|
|
3
|
-
import { DocumentLike } from "../";
|
|
4
|
-
export declare function findReferences(doc: DocumentLike, sourceFile: SourceFile, position:
|
|
5
|
-
export declare function findDefinition(doc: DocumentLike, sourceFile: SourceFile, position:
|
|
1
|
+
import type { Position, ReferenceContext, Location } from "vscode-languageserver-types";
|
|
2
|
+
import type { SourceFile } from "../types";
|
|
3
|
+
import { type DocumentLike } from "../";
|
|
4
|
+
export declare function findReferences(doc: DocumentLike, sourceFile: SourceFile, position: Position, context: ReferenceContext): Location[];
|
|
5
|
+
export declare function findDefinition(doc: DocumentLike, sourceFile: SourceFile, position: Position): Location | undefined;
|
package/lib/service/reference.js
CHANGED
|
@@ -58,8 +58,6 @@ function findDefinition(doc, sourceFile, position) {
|
|
|
58
58
|
const nodeSymbol = node.symbol;
|
|
59
59
|
if (!nodeSymbol)
|
|
60
60
|
throw "node.symbol is not bound";
|
|
61
|
-
const refs = nodeSymbol.references || [];
|
|
62
|
-
let symbolRefs;
|
|
63
61
|
const firstMention = nodeSymbol.firstMention;
|
|
64
62
|
if (!firstMention)
|
|
65
63
|
return undefined;
|
package/lib/service/rename.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Position, WorkspaceEdit } from "vscode-languageserver-types";
|
|
2
2
|
import { SourceFile } from "../types";
|
|
3
3
|
import { DocumentLike } from "../";
|
|
4
|
-
export declare function renameSymbol(doc: DocumentLike, sourceFile: SourceFile, position:
|
|
4
|
+
export declare function renameSymbol(doc: DocumentLike, sourceFile: SourceFile, position: Position, newName: string): WorkspaceEdit | undefined;
|
package/lib/service/rename.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.renameSymbol = void 0;
|
|
4
|
-
const
|
|
4
|
+
const vscode_languageserver_types_1 = require("vscode-languageserver-types");
|
|
5
5
|
const types_1 = require("../types");
|
|
6
6
|
const checker_1 = require("../checker");
|
|
7
7
|
const __1 = require("../");
|
|
@@ -29,7 +29,7 @@ function renameSymbol(doc, sourceFile, position, newName) {
|
|
|
29
29
|
const uri = doc.uri;
|
|
30
30
|
const res = {
|
|
31
31
|
changes: {
|
|
32
|
-
[uri]: ranges.map(r =>
|
|
32
|
+
[uri]: ranges.map(r => vscode_languageserver_types_1.TextEdit.replace(r, newName)),
|
|
33
33
|
}
|
|
34
34
|
};
|
|
35
35
|
return res;
|
package/lib/service/service.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import * as lst from "vscode-languageserver-types";
|
|
1
|
+
import type * as lst from "vscode-languageserver-types";
|
|
2
|
+
import type { TextDocument } from "vscode-languageserver-textdocument";
|
|
2
3
|
import { ColorInformation, Color, ColorPresentation } from "./polyfill";
|
|
3
4
|
import { SourceFile, Omit } from "../types";
|
|
4
5
|
export interface DocumentLike {
|
|
@@ -11,7 +12,7 @@ export interface CommandApplication {
|
|
|
11
12
|
edit: lst.WorkspaceEdit;
|
|
12
13
|
}
|
|
13
14
|
export interface LanguageService {
|
|
14
|
-
parseDocument(doc:
|
|
15
|
+
parseDocument(doc: TextDocument | string): SourceFile;
|
|
15
16
|
validateDocument(doc: DocumentLike, sourceFile: SourceFile): lst.Diagnostic[];
|
|
16
17
|
hover(doc: DocumentLike, sourceFile: SourceFile, position: lst.Position): lst.Hover | undefined;
|
|
17
18
|
findReferences(doc: DocumentLike, sourceFile: SourceFile, position: lst.Position, context: lst.ReferenceContext): lst.Location[];
|
package/lib/service/util.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import
|
|
1
|
+
import type { Range } from "vscode-languageserver-types";
|
|
2
2
|
import { SourceFile, SyntaxNode } from "../types";
|
|
3
|
-
import { DocumentLike } from "../";
|
|
3
|
+
import type { DocumentLike } from "../";
|
|
4
4
|
export declare function getStart(sourceFile: SourceFile, node: SyntaxNode): number;
|
|
5
|
-
export declare function syntaxNodesToRanges(doc: DocumentLike, sourceFile: SourceFile, nodes: SyntaxNode[]):
|
|
5
|
+
export declare function syntaxNodesToRanges(doc: DocumentLike, sourceFile: SourceFile, nodes: SyntaxNode[]): Range[];
|
|
6
6
|
export declare function syntaxNodeToRange(doc: DocumentLike, sourceFile: SourceFile, node: SyntaxNode): {
|
|
7
|
-
start:
|
|
8
|
-
end:
|
|
7
|
+
start: import("vscode-languageserver-types").Position;
|
|
8
|
+
end: import("vscode-languageserver-types").Position;
|
|
9
9
|
};
|
|
10
10
|
export declare function escapeIdentifierText(text: string): string;
|
|
11
|
-
export declare function assertNever(
|
|
11
|
+
export declare function assertNever(v: never): never;
|
package/lib/service/util.js
CHANGED
|
@@ -45,8 +45,8 @@ function escapeIdentifierText(text) {
|
|
|
45
45
|
}
|
|
46
46
|
exports.escapeIdentifierText = escapeIdentifierText;
|
|
47
47
|
const quote = (s) => "\"" + s + "\"";
|
|
48
|
-
function assertNever(
|
|
49
|
-
throw new Error("
|
|
48
|
+
function assertNever(v) {
|
|
49
|
+
throw new Error("Should not have reached this. Value: " + (v !== null && v !== void 0 ? v : ""));
|
|
50
50
|
}
|
|
51
51
|
exports.assertNever = assertNever;
|
|
52
52
|
//# sourceMappingURL=util.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dot-language-support",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.7.0",
|
|
4
4
|
"description": "Parser and language service for graphviz (dot) files",
|
|
5
5
|
"author": "Niklas Mollenhauer",
|
|
6
6
|
"license": "MIT",
|
|
@@ -25,18 +25,18 @@
|
|
|
25
25
|
"url": "https://github.com/nikeee/dot-language-support.git"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
+
"vscode-languageserver-textdocument": "^1.0.4",
|
|
28
29
|
"vscode-languageserver-types": "^3.16.0"
|
|
29
30
|
},
|
|
30
31
|
"devDependencies": {
|
|
31
|
-
"@types/chai": "^4.3.
|
|
32
|
-
"@types/mocha": "^9.1.
|
|
32
|
+
"@types/chai": "^4.3.1",
|
|
33
|
+
"@types/mocha": "^9.1.1",
|
|
33
34
|
"chai": "^4.3.6",
|
|
34
|
-
"mocha": "^
|
|
35
|
+
"mocha": "^10.0.0",
|
|
35
36
|
"ts-node": "^10.7.0",
|
|
36
|
-
"typescript": "^4.6.
|
|
37
|
-
"vscode-languageserver": "^7.0.0"
|
|
37
|
+
"typescript": "^4.6.4"
|
|
38
38
|
},
|
|
39
39
|
"engines": {
|
|
40
|
-
"node": ">=
|
|
40
|
+
"node": ">=16"
|
|
41
41
|
}
|
|
42
42
|
}
|
package/lib/service/interop.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import * as lst from "vscode-languageserver-types";
|
|
2
|
-
import { DiagnosticMessage } from "../types";
|
|
3
|
-
import { DocumentLike } from "../";
|
|
4
|
-
export interface IMarkerData {
|
|
5
|
-
code?: string;
|
|
6
|
-
severity: number;
|
|
7
|
-
message: string;
|
|
8
|
-
source?: string;
|
|
9
|
-
startLineNumber: number;
|
|
10
|
-
startColumn: number;
|
|
11
|
-
endLineNumber: number;
|
|
12
|
-
endColumn: number;
|
|
13
|
-
}
|
|
14
|
-
export declare function getDiagnosticMarkerData(doc: DocumentLike, source: DiagnosticMessage): IMarkerData;
|
|
15
|
-
export declare function getMarkerDataDiagnostic(m: IMarkerData): lst.Diagnostic;
|
package/lib/service/interop.js
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getMarkerDataDiagnostic = exports.getDiagnosticMarkerData = void 0;
|
|
4
|
-
const lst = require("vscode-languageserver-types");
|
|
5
|
-
const types_1 = require("../types");
|
|
6
|
-
function getDiagnosticMarkerData(doc, source) {
|
|
7
|
-
const start = doc.positionAt(source.start);
|
|
8
|
-
const end = doc.positionAt(source.end);
|
|
9
|
-
return {
|
|
10
|
-
message: source.message,
|
|
11
|
-
severity: source.category ? convertToMonacoSeverity(source.category) : 0,
|
|
12
|
-
startLineNumber: start.line,
|
|
13
|
-
startColumn: start.character,
|
|
14
|
-
endLineNumber: end.line,
|
|
15
|
-
endColumn: end.character,
|
|
16
|
-
};
|
|
17
|
-
}
|
|
18
|
-
exports.getDiagnosticMarkerData = getDiagnosticMarkerData;
|
|
19
|
-
function getMarkerDataDiagnostic(m) {
|
|
20
|
-
return {
|
|
21
|
-
message: m.message,
|
|
22
|
-
range: {
|
|
23
|
-
start: {
|
|
24
|
-
line: m.startLineNumber,
|
|
25
|
-
character: m.startColumn,
|
|
26
|
-
},
|
|
27
|
-
end: {
|
|
28
|
-
line: m.endLineNumber,
|
|
29
|
-
character: m.endColumn,
|
|
30
|
-
}
|
|
31
|
-
},
|
|
32
|
-
code: m.code,
|
|
33
|
-
severity: m.severity ? convertToLspSeverity(m.severity) : types_1.DiagnosticCategory.Suggestion,
|
|
34
|
-
source: m.source,
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
exports.getMarkerDataDiagnostic = getMarkerDataDiagnostic;
|
|
38
|
-
const lspToMonacoSeverityMap = {
|
|
39
|
-
[lst.DiagnosticSeverity.Error]: 3,
|
|
40
|
-
[lst.DiagnosticSeverity.Warning]: 2,
|
|
41
|
-
[lst.DiagnosticSeverity.Information]: 1,
|
|
42
|
-
[lst.DiagnosticSeverity.Hint]: 0,
|
|
43
|
-
};
|
|
44
|
-
const monacoToLspSeverityMap = {
|
|
45
|
-
[3]: lst.DiagnosticSeverity.Error,
|
|
46
|
-
[2]: lst.DiagnosticSeverity.Warning,
|
|
47
|
-
[1]: lst.DiagnosticSeverity.Information,
|
|
48
|
-
[0]: lst.DiagnosticSeverity.Hint,
|
|
49
|
-
};
|
|
50
|
-
function convertToMonacoSeverity(s) {
|
|
51
|
-
return lspToMonacoSeverityMap[s];
|
|
52
|
-
}
|
|
53
|
-
function convertToLspSeverity(n) {
|
|
54
|
-
return monacoToLspSeverityMap[n];
|
|
55
|
-
}
|
|
56
|
-
//# sourceMappingURL=interop.js.map
|