@samchon/graph 0.1.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/LICENSE +21 -0
- package/README.md +129 -0
- package/lib/AsyncSamchonGraphSource.d.ts +2 -0
- package/lib/AsyncSamchonGraphSource.js +3 -0
- package/lib/AsyncSamchonGraphSource.js.map +1 -0
- package/lib/SamchonGraphApplication.d.ts +10 -0
- package/lib/SamchonGraphApplication.js +64 -0
- package/lib/SamchonGraphApplication.js.map +1 -0
- package/lib/SamchonGraphSource.d.ts +2 -0
- package/lib/SamchonGraphSource.js +3 -0
- package/lib/SamchonGraphSource.js.map +1 -0
- package/lib/application.d.ts +3 -0
- package/lib/application.js +20 -0
- package/lib/application.js.map +1 -0
- package/lib/bin.d.ts +2 -0
- package/lib/bin.js +8 -0
- package/lib/bin.js.map +1 -0
- package/lib/index.d.ts +13 -0
- package/lib/index.js +30 -0
- package/lib/index.js.map +1 -0
- package/lib/indexer/IBuildGraphOptions.d.ts +41 -0
- package/lib/indexer/IBuildGraphOptions.js +3 -0
- package/lib/indexer/IBuildGraphOptions.js.map +1 -0
- package/lib/indexer/IIndexerResult.d.ts +5 -0
- package/lib/indexer/IIndexerResult.js +3 -0
- package/lib/indexer/IIndexerResult.js.map +1 -0
- package/lib/indexer/ILanguageSpec.d.ts +10 -0
- package/lib/indexer/ILanguageSpec.js +3 -0
- package/lib/indexer/ILanguageSpec.js.map +1 -0
- package/lib/indexer/LANGUAGE_SPECS.d.ts +2 -0
- package/lib/indexer/LANGUAGE_SPECS.js +114 -0
- package/lib/indexer/LANGUAGE_SPECS.js.map +1 -0
- package/lib/indexer/allExtensions.d.ts +2 -0
- package/lib/indexer/allExtensions.js +16 -0
- package/lib/indexer/allExtensions.js.map +1 -0
- package/lib/indexer/buildGraph.d.ts +3 -0
- package/lib/indexer/buildGraph.js +10 -0
- package/lib/indexer/buildGraph.js.map +1 -0
- package/lib/indexer/buildGraphDump.d.ts +3 -0
- package/lib/indexer/buildGraphDump.js +394 -0
- package/lib/indexer/buildGraphDump.js.map +1 -0
- package/lib/indexer/buildLspGraph.d.ts +3 -0
- package/lib/indexer/buildLspGraph.js +617 -0
- package/lib/indexer/buildLspGraph.js.map +1 -0
- package/lib/indexer/buildStaticGraph.d.ts +3 -0
- package/lib/indexer/buildStaticGraph.js +479 -0
- package/lib/indexer/buildStaticGraph.js.map +1 -0
- package/lib/indexer/decoratorsAbove.d.ts +1 -0
- package/lib/indexer/decoratorsAbove.js +14 -0
- package/lib/indexer/decoratorsAbove.js.map +1 -0
- package/lib/indexer/languageOf.d.ts +2 -0
- package/lib/indexer/languageOf.js +19 -0
- package/lib/indexer/languageOf.js.map +1 -0
- package/lib/indexer/languages.d.ts +5 -0
- package/lib/indexer/languages.js +22 -0
- package/lib/indexer/languages.js.map +1 -0
- package/lib/indexer/lspIndexer.d.ts +1 -0
- package/lib/indexer/lspIndexer.js +18 -0
- package/lib/indexer/lspIndexer.js.map +1 -0
- package/lib/indexer/overrideEdges.d.ts +2 -0
- package/lib/indexer/overrideEdges.js +45 -0
- package/lib/indexer/overrideEdges.js.map +1 -0
- package/lib/indexer/resolveType.d.ts +2 -0
- package/lib/indexer/resolveType.js +11 -0
- package/lib/indexer/resolveType.js.map +1 -0
- package/lib/indexer/specOf.d.ts +3 -0
- package/lib/indexer/specOf.js +8 -0
- package/lib/indexer/specOf.js.map +1 -0
- package/lib/indexer/staticIndexer.d.ts +1 -0
- package/lib/indexer/staticIndexer.js +18 -0
- package/lib/indexer/staticIndexer.js.map +1 -0
- package/lib/indexer/supertypesOf.d.ts +4 -0
- package/lib/indexer/supertypesOf.js +48 -0
- package/lib/indexer/supertypesOf.js.map +1 -0
- package/lib/lsp/DocumentSymbolResult.d.ts +3 -0
- package/lib/lsp/DocumentSymbolResult.js +3 -0
- package/lib/lsp/DocumentSymbolResult.js.map +1 -0
- package/lib/lsp/IDiagnostic.d.ts +8 -0
- package/lib/lsp/IDiagnostic.js +3 -0
- package/lib/lsp/IDiagnostic.js.map +1 -0
- package/lib/lsp/IDocumentSymbol.d.ts +9 -0
- package/lib/lsp/IDocumentSymbol.js +3 -0
- package/lib/lsp/IDocumentSymbol.js.map +1 -0
- package/lib/lsp/ILocation.d.ts +5 -0
- package/lib/lsp/ILocation.js +3 -0
- package/lib/lsp/ILocation.js.map +1 -0
- package/lib/lsp/IPosition.d.ts +4 -0
- package/lib/lsp/IPosition.js +3 -0
- package/lib/lsp/IPosition.js.map +1 -0
- package/lib/lsp/IRange.d.ts +5 -0
- package/lib/lsp/IRange.js +3 -0
- package/lib/lsp/IRange.js.map +1 -0
- package/lib/lsp/ISymbolInformation.d.ts +7 -0
- package/lib/lsp/ISymbolInformation.js +3 -0
- package/lib/lsp/ISymbolInformation.js.map +1 -0
- package/lib/lsp/LspClient.d.ts +17 -0
- package/lib/lsp/LspClient.js +140 -0
- package/lib/lsp/LspClient.js.map +1 -0
- package/lib/lsp/isDocumentSymbol.d.ts +3 -0
- package/lib/lsp/isDocumentSymbol.js +7 -0
- package/lib/lsp/isDocumentSymbol.js.map +1 -0
- package/lib/lsp/types.d.ts +8 -0
- package/lib/lsp/types.js +25 -0
- package/lib/lsp/types.js.map +1 -0
- package/lib/mcp/createServer.d.ts +3 -0
- package/lib/mcp/createServer.js +1947 -0
- package/lib/mcp/createServer.js.map +1 -0
- package/lib/mcp/startServer.d.ts +5 -0
- package/lib/mcp/startServer.js +23 -0
- package/lib/mcp/startServer.js.map +1 -0
- package/lib/model/GraphMemory.d.ts +25 -0
- package/lib/model/GraphMemory.js +141 -0
- package/lib/model/GraphMemory.js.map +1 -0
- package/lib/operations/bound.d.ts +1 -0
- package/lib/operations/bound.js +8 -0
- package/lib/operations/bound.js.map +1 -0
- package/lib/operations/common.d.ts +15 -0
- package/lib/operations/common.js +32 -0
- package/lib/operations/common.js.map +1 -0
- package/lib/operations/compareEdges.d.ts +2 -0
- package/lib/operations/compareEdges.js +10 -0
- package/lib/operations/compareEdges.js.map +1 -0
- package/lib/operations/edgeRank.d.ts +1 -0
- package/lib/operations/edgeRank.js +25 -0
- package/lib/operations/edgeRank.js.map +1 -0
- package/lib/operations/isExecution.d.ts +1 -0
- package/lib/operations/isExecution.js +11 -0
- package/lib/operations/isExecution.js.map +1 -0
- package/lib/operations/isPublicApiNoisePath.d.ts +2 -0
- package/lib/operations/isPublicApiNoisePath.js +11 -0
- package/lib/operations/isPublicApiNoisePath.js.map +1 -0
- package/lib/operations/isStructural.d.ts +1 -0
- package/lib/operations/isStructural.js +7 -0
- package/lib/operations/isStructural.js.map +1 -0
- package/lib/operations/isSupportPath.d.ts +2 -0
- package/lib/operations/isSupportPath.js +16 -0
- package/lib/operations/isSupportPath.js.map +1 -0
- package/lib/operations/isTestPath.d.ts +1 -0
- package/lib/operations/isTestPath.js +9 -0
- package/lib/operations/isTestPath.js.map +1 -0
- package/lib/operations/isTypeEdge.d.ts +1 -0
- package/lib/operations/isTypeEdge.js +11 -0
- package/lib/operations/isTypeEdge.js.map +1 -0
- package/lib/operations/publicEvidence.d.ts +2 -0
- package/lib/operations/publicEvidence.js +13 -0
- package/lib/operations/publicEvidence.js.map +1 -0
- package/lib/operations/referencesFromEdges.d.ts +3 -0
- package/lib/operations/referencesFromEdges.js +38 -0
- package/lib/operations/referencesFromEdges.js.map +1 -0
- package/lib/operations/resolveHandle.d.ts +6 -0
- package/lib/operations/resolveHandle.js +28 -0
- package/lib/operations/resolveHandle.js.map +1 -0
- package/lib/operations/resultGuide.d.ts +1 -0
- package/lib/operations/resultGuide.js +7 -0
- package/lib/operations/resultGuide.js.map +1 -0
- package/lib/operations/resultNext.d.ts +2 -0
- package/lib/operations/resultNext.js +7 -0
- package/lib/operations/resultNext.js.map +1 -0
- package/lib/operations/runDetails.d.ts +8 -0
- package/lib/operations/runDetails.js +190 -0
- package/lib/operations/runDetails.js.map +1 -0
- package/lib/operations/runEntrypoints.d.ts +9 -0
- package/lib/operations/runEntrypoints.js +122 -0
- package/lib/operations/runEntrypoints.js.map +1 -0
- package/lib/operations/runLookup.d.ts +10 -0
- package/lib/operations/runLookup.js +229 -0
- package/lib/operations/runLookup.js.map +1 -0
- package/lib/operations/runOverview.d.ts +10 -0
- package/lib/operations/runOverview.js +142 -0
- package/lib/operations/runOverview.js.map +1 -0
- package/lib/operations/runTour.d.ts +8 -0
- package/lib/operations/runTour.js +539 -0
- package/lib/operations/runTour.js.map +1 -0
- package/lib/operations/runTrace.d.ts +10 -0
- package/lib/operations/runTrace.js +283 -0
- package/lib/operations/runTrace.js.map +1 -0
- package/lib/operations/signatureOf.d.ts +2 -0
- package/lib/operations/signatureOf.js +45 -0
- package/lib/operations/signatureOf.js.map +1 -0
- package/lib/operations/subwords.d.ts +1 -0
- package/lib/operations/subwords.js +12 -0
- package/lib/operations/subwords.js.map +1 -0
- package/lib/operations/summaryOf.d.ts +2 -0
- package/lib/operations/summaryOf.js +24 -0
- package/lib/operations/summaryOf.js.map +1 -0
- package/lib/runGraph.d.ts +1 -0
- package/lib/runGraph.js +165 -0
- package/lib/runGraph.js.map +1 -0
- package/lib/structures/GraphEdgeKind.d.ts +10 -0
- package/lib/structures/GraphEdgeKind.js +3 -0
- package/lib/structures/GraphEdgeKind.js.map +1 -0
- package/lib/structures/GraphLanguage.d.ts +2 -0
- package/lib/structures/GraphLanguage.js +3 -0
- package/lib/structures/GraphLanguage.js.map +1 -0
- package/lib/structures/GraphNodeKind.d.ts +11 -0
- package/lib/structures/GraphNodeKind.js +3 -0
- package/lib/structures/GraphNodeKind.js.map +1 -0
- package/lib/structures/IGraphDecorator.d.ts +22 -0
- package/lib/structures/IGraphDecorator.js +3 -0
- package/lib/structures/IGraphDecorator.js.map +1 -0
- package/lib/structures/IGraphDetails.d.ts +126 -0
- package/lib/structures/IGraphDetails.js +3 -0
- package/lib/structures/IGraphDetails.js.map +1 -0
- package/lib/structures/IGraphDiagnostic.d.ts +23 -0
- package/lib/structures/IGraphDiagnostic.js +3 -0
- package/lib/structures/IGraphDiagnostic.js.map +1 -0
- package/lib/structures/IGraphDump.d.ts +37 -0
- package/lib/structures/IGraphDump.js +3 -0
- package/lib/structures/IGraphDump.js.map +1 -0
- package/lib/structures/IGraphEdge.d.ts +20 -0
- package/lib/structures/IGraphEdge.js +3 -0
- package/lib/structures/IGraphEdge.js.map +1 -0
- package/lib/structures/IGraphEntrypoints.d.ts +57 -0
- package/lib/structures/IGraphEntrypoints.js +3 -0
- package/lib/structures/IGraphEntrypoints.js.map +1 -0
- package/lib/structures/IGraphEscape.d.ts +40 -0
- package/lib/structures/IGraphEscape.js +3 -0
- package/lib/structures/IGraphEscape.js.map +1 -0
- package/lib/structures/IGraphEvidence.d.ts +24 -0
- package/lib/structures/IGraphEvidence.js +3 -0
- package/lib/structures/IGraphEvidence.js.map +1 -0
- package/lib/structures/IGraphLookup.d.ts +66 -0
- package/lib/structures/IGraphLookup.js +3 -0
- package/lib/structures/IGraphLookup.js.map +1 -0
- package/lib/structures/IGraphNext.d.ts +15 -0
- package/lib/structures/IGraphNext.js +3 -0
- package/lib/structures/IGraphNext.js.map +1 -0
- package/lib/structures/IGraphNode.d.ts +62 -0
- package/lib/structures/IGraphNode.js +3 -0
- package/lib/structures/IGraphNode.js.map +1 -0
- package/lib/structures/IGraphOverview.d.ts +100 -0
- package/lib/structures/IGraphOverview.js +3 -0
- package/lib/structures/IGraphOverview.js.map +1 -0
- package/lib/structures/IGraphTour.d.ts +54 -0
- package/lib/structures/IGraphTour.js +3 -0
- package/lib/structures/IGraphTour.js.map +1 -0
- package/lib/structures/IGraphTrace.d.ts +126 -0
- package/lib/structures/IGraphTrace.js +3 -0
- package/lib/structures/IGraphTrace.js.map +1 -0
- package/lib/structures/ISamchonGraphApplication.d.ts +162 -0
- package/lib/structures/ISamchonGraphApplication.js +3 -0
- package/lib/structures/ISamchonGraphApplication.js.map +1 -0
- package/lib/structures/index.d.ts +18 -0
- package/lib/structures/index.js +35 -0
- package/lib/structures/index.js.map +1 -0
- package/lib/structures.d.ts +1 -0
- package/lib/structures.js +18 -0
- package/lib/structures.js.map +1 -0
- package/lib/utils/DEFAULT_IGNORES.d.ts +1 -0
- package/lib/utils/DEFAULT_IGNORES.js +39 -0
- package/lib/utils/DEFAULT_IGNORES.js.map +1 -0
- package/lib/utils/IWalkOptions.d.ts +5 -0
- package/lib/utils/IWalkOptions.js +3 -0
- package/lib/utils/IWalkOptions.js.map +1 -0
- package/lib/utils/basename.d.ts +1 -0
- package/lib/utils/basename.js +10 -0
- package/lib/utils/basename.js.map +1 -0
- package/lib/utils/dirname.d.ts +1 -0
- package/lib/utils/dirname.js +10 -0
- package/lib/utils/dirname.js.map +1 -0
- package/lib/utils/fileFromUri.d.ts +1 -0
- package/lib/utils/fileFromUri.js +20 -0
- package/lib/utils/fileFromUri.js.map +1 -0
- package/lib/utils/fileUri.d.ts +1 -0
- package/lib/utils/fileUri.js +19 -0
- package/lib/utils/fileUri.js.map +1 -0
- package/lib/utils/fs.d.ts +6 -0
- package/lib/utils/fs.js +23 -0
- package/lib/utils/fs.js.map +1 -0
- package/lib/utils/isSubPath.d.ts +1 -0
- package/lib/utils/isSubPath.js +15 -0
- package/lib/utils/isSubPath.js.map +1 -0
- package/lib/utils/normalizePath.d.ts +1 -0
- package/lib/utils/normalizePath.js +7 -0
- package/lib/utils/normalizePath.js.map +1 -0
- package/lib/utils/path.d.ts +7 -0
- package/lib/utils/path.js +24 -0
- package/lib/utils/path.js.map +1 -0
- package/lib/utils/projectRelative.d.ts +1 -0
- package/lib/utils/projectRelative.js +9 -0
- package/lib/utils/projectRelative.js.map +1 -0
- package/lib/utils/readLines.d.ts +1 -0
- package/lib/utils/readLines.js +8 -0
- package/lib/utils/readLines.js.map +1 -0
- package/lib/utils/readText.d.ts +1 -0
- package/lib/utils/readText.js +17 -0
- package/lib/utils/readText.js.map +1 -0
- package/lib/utils/relativePath.d.ts +1 -0
- package/lib/utils/relativePath.js +12 -0
- package/lib/utils/relativePath.js.map +1 -0
- package/lib/utils/walkSourceFiles.d.ts +2 -0
- package/lib/utils/walkSourceFiles.js +44 -0
- package/lib/utils/walkSourceFiles.js.map +1 -0
- package/package.json +55 -0
- package/src/AsyncSamchonGraphSource.ts +5 -0
- package/src/SamchonGraphApplication.ts +74 -0
- package/src/SamchonGraphSource.ts +3 -0
- package/src/application.ts +3 -0
- package/src/bin.ts +6 -0
- package/src/index.ts +13 -0
- package/src/indexer/IBuildGraphOptions.ts +42 -0
- package/src/indexer/IIndexerResult.ts +6 -0
- package/src/indexer/ILanguageSpec.ts +11 -0
- package/src/indexer/LANGUAGE_SPECS.ts +112 -0
- package/src/indexer/allExtensions.ts +12 -0
- package/src/indexer/buildGraph.ts +10 -0
- package/src/indexer/buildGraphDump.ts +29 -0
- package/src/indexer/buildLspGraph.ts +710 -0
- package/src/indexer/buildStaticGraph.ts +507 -0
- package/src/indexer/decoratorsAbove.ts +9 -0
- package/src/indexer/languageOf.ts +13 -0
- package/src/indexer/languages.ts +5 -0
- package/src/indexer/lspIndexer.ts +1 -0
- package/src/indexer/overrideEdges.ts +42 -0
- package/src/indexer/resolveType.ts +14 -0
- package/src/indexer/specOf.ts +7 -0
- package/src/indexer/staticIndexer.ts +1 -0
- package/src/indexer/supertypesOf.ts +43 -0
- package/src/lsp/DocumentSymbolResult.ts +4 -0
- package/src/lsp/IDiagnostic.ts +9 -0
- package/src/lsp/IDocumentSymbol.ts +10 -0
- package/src/lsp/ILocation.ts +6 -0
- package/src/lsp/IPosition.ts +4 -0
- package/src/lsp/IRange.ts +6 -0
- package/src/lsp/ISymbolInformation.ts +8 -0
- package/src/lsp/LspClient.ts +165 -0
- package/src/lsp/isDocumentSymbol.ts +8 -0
- package/src/lsp/types.ts +8 -0
- package/src/mcp/createServer.ts +23 -0
- package/src/mcp/startServer.ts +23 -0
- package/src/model/GraphMemory.ts +165 -0
- package/src/operations/bound.ts +9 -0
- package/src/operations/common.ts +15 -0
- package/src/operations/compareEdges.ts +10 -0
- package/src/operations/edgeRank.ts +23 -0
- package/src/operations/isExecution.ts +9 -0
- package/src/operations/isPublicApiNoisePath.ts +10 -0
- package/src/operations/isStructural.ts +3 -0
- package/src/operations/isSupportPath.ts +16 -0
- package/src/operations/isTestPath.ts +7 -0
- package/src/operations/isTypeEdge.ts +9 -0
- package/src/operations/publicEvidence.ts +11 -0
- package/src/operations/referencesFromEdges.ts +37 -0
- package/src/operations/resolveHandle.ts +27 -0
- package/src/operations/resultGuide.ts +3 -0
- package/src/operations/resultNext.ts +9 -0
- package/src/operations/runDetails.ts +240 -0
- package/src/operations/runEntrypoints.ts +153 -0
- package/src/operations/runLookup.ts +269 -0
- package/src/operations/runOverview.ts +158 -0
- package/src/operations/runTour.ts +582 -0
- package/src/operations/runTrace.ts +339 -0
- package/src/operations/signatureOf.ts +40 -0
- package/src/operations/subwords.ts +8 -0
- package/src/operations/summaryOf.ts +21 -0
- package/src/runGraph.ts +144 -0
- package/src/structures/GraphEdgeKind.ts +24 -0
- package/src/structures/GraphLanguage.ts +21 -0
- package/src/structures/GraphNodeKind.ts +27 -0
- package/src/structures/IGraphDecorator.ts +25 -0
- package/src/structures/IGraphDetails.ts +153 -0
- package/src/structures/IGraphDiagnostic.ts +29 -0
- package/src/structures/IGraphDump.ts +45 -0
- package/src/structures/IGraphEdge.ts +24 -0
- package/src/structures/IGraphEntrypoints.ts +70 -0
- package/src/structures/IGraphEscape.ts +49 -0
- package/src/structures/IGraphEvidence.ts +29 -0
- package/src/structures/IGraphLookup.ts +80 -0
- package/src/structures/IGraphNext.ts +23 -0
- package/src/structures/IGraphNode.ts +76 -0
- package/src/structures/IGraphOverview.ts +121 -0
- package/src/structures/IGraphTour.ts +68 -0
- package/src/structures/IGraphTrace.ts +154 -0
- package/src/structures/ISamchonGraphApplication.ts +186 -0
- package/src/structures/index.ts +18 -0
- package/src/structures.ts +1 -0
- package/src/utils/DEFAULT_IGNORES.ts +35 -0
- package/src/utils/IWalkOptions.ts +5 -0
- package/src/utils/basename.ts +7 -0
- package/src/utils/dirname.ts +7 -0
- package/src/utils/fileFromUri.ts +14 -0
- package/src/utils/fileUri.ts +13 -0
- package/src/utils/fs.ts +6 -0
- package/src/utils/isSubPath.ts +9 -0
- package/src/utils/normalizePath.ts +3 -0
- package/src/utils/path.ts +7 -0
- package/src/utils/projectRelative.ts +6 -0
- package/src/utils/readLines.ts +5 -0
- package/src/utils/readText.ts +10 -0
- package/src/utils/relativePath.ts +7 -0
- package/src/utils/walkSourceFiles.ts +35 -0
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.overrideEdges = overrideEdges;
|
|
4
|
+
// Given a graph that already carries `contains` (owner -> member) and
|
|
5
|
+
// `extends`/`implements` (subtype -> supertype) edges, link a method to the
|
|
6
|
+
// supertype method it overrides: a same-named method reachable on a supertype.
|
|
7
|
+
function overrideEdges(nodes, edges) {
|
|
8
|
+
const byId = new Map(nodes.map((node) => [node.id, node]));
|
|
9
|
+
const methodsByOwner = new Map();
|
|
10
|
+
for (const edge of edges) {
|
|
11
|
+
if (edge.kind !== "contains")
|
|
12
|
+
continue;
|
|
13
|
+
const member = byId.get(edge.to);
|
|
14
|
+
if (member === undefined || member.kind !== "method")
|
|
15
|
+
continue;
|
|
16
|
+
let methods = methodsByOwner.get(edge.from);
|
|
17
|
+
if (methods === undefined) {
|
|
18
|
+
methods = new Map();
|
|
19
|
+
methodsByOwner.set(edge.from, methods);
|
|
20
|
+
}
|
|
21
|
+
methods.set(member.name, member);
|
|
22
|
+
}
|
|
23
|
+
const out = [];
|
|
24
|
+
for (const edge of edges) {
|
|
25
|
+
if (edge.kind !== "extends" && edge.kind !== "implements")
|
|
26
|
+
continue;
|
|
27
|
+
const subMethods = methodsByOwner.get(edge.from);
|
|
28
|
+
const superMethods = methodsByOwner.get(edge.to);
|
|
29
|
+
if (subMethods === undefined || superMethods === undefined)
|
|
30
|
+
continue;
|
|
31
|
+
for (const [name, subMethod] of subMethods) {
|
|
32
|
+
const superMethod = superMethods.get(name);
|
|
33
|
+
if (superMethod === undefined)
|
|
34
|
+
continue;
|
|
35
|
+
out.push({
|
|
36
|
+
from: subMethod.id,
|
|
37
|
+
to: superMethod.id,
|
|
38
|
+
kind: "overrides",
|
|
39
|
+
evidence: subMethod.evidence,
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
return out;
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=overrideEdges.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"overrideEdges.js","sourceRoot":"","sources":["../../src/indexer/overrideEdges.ts"],"names":[],"mappings":";;;AAEA,sEAAsE;AACtE,4EAA4E;AAC5E,+EAA+E;AAC/E,uBACE,KAA4B,EAC5B,KAA4B;IAE5B,MAAM,IAAI,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC;IAC3D,MAAM,cAAc,GAAG,IAAI,GAAG,EAAmC,CAAC;IAClE,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,IAAI,IAAI,CAAC,IAAI,KAAK,UAAU;YAAE,SAAS;QACvC,MAAM,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACjC,IAAI,MAAM,KAAK,SAAS,IAAI,MAAM,CAAC,IAAI,KAAK,QAAQ;YAAE,SAAS;QAC/D,IAAI,OAAO,GAAG,cAAc,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC5C,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;YAC1B,OAAO,GAAG,IAAI,GAAG,EAAE,CAAC;YACpB,cAAc,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QACzC,CAAC;QACD,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IACnC,CAAC;IAED,MAAM,GAAG,GAAiB,EAAE,CAAC;IAC7B,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,IAAI,IAAI,CAAC,IAAI,KAAK,SAAS,IAAI,IAAI,CAAC,IAAI,KAAK,YAAY;YAAE,SAAS;QACpE,MAAM,UAAU,GAAG,cAAc,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACjD,MAAM,YAAY,GAAG,cAAc,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACjD,IAAI,UAAU,KAAK,SAAS,IAAI,YAAY,KAAK,SAAS;YAAE,SAAS;QACrE,KAAK,MAAM,CAAC,IAAI,EAAE,SAAS,CAAC,IAAI,UAAU,EAAE,CAAC;YAC3C,MAAM,WAAW,GAAG,YAAY,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;YAC3C,IAAI,WAAW,KAAK,SAAS;gBAAE,SAAS;YACxC,GAAG,CAAC,IAAI,CAAC;gBACP,IAAI,EAAE,SAAS,CAAC,EAAE;gBAClB,EAAE,EAAE,WAAW,CAAC,EAAE;gBAClB,IAAI,EAAE,WAAW;gBACjB,QAAQ,EAAE,SAAS,CAAC,QAAQ;aAC7B,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.resolveType = resolveType;
|
|
4
|
+
function resolveType(name, source, byName) {
|
|
5
|
+
const candidates = byName.get(name.split(".").pop());
|
|
6
|
+
if (candidates === undefined)
|
|
7
|
+
return undefined;
|
|
8
|
+
return (candidates.find((node) => node.id !== source.id && node.file === source.file) ??
|
|
9
|
+
candidates.find((node) => node.id !== source.id));
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=resolveType.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolveType.js","sourceRoot":"","sources":["../../src/indexer/resolveType.ts"],"names":[],"mappings":";;;AAEA,qBACE,IAAY,EACZ,MAAkB,EAClB,MAAiC;IAEjC,MAAM,UAAU,GAAG,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAG,CAAC,CAAC;IACtD,IAAI,UAAU,KAAK,SAAS;QAAE,OAAO,SAAS,CAAC;IAC/C,OAAO,CACL,UAAU,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,EAAE,KAAK,MAAM,CAAC,EAAE,IAAI,IAAI,CAAC,IAAI,KAAK,MAAM,CAAC,IAAI,CAAC;QAC7E,UAAU,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,EAAE,KAAK,MAAM,CAAC,EAAE,CAAC,CACjD,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.specOf = specOf;
|
|
4
|
+
const LANGUAGE_SPECS_1 = require("./LANGUAGE_SPECS");
|
|
5
|
+
function specOf(language) {
|
|
6
|
+
return LANGUAGE_SPECS_1.LANGUAGE_SPECS.find((spec) => spec.language === language);
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=specOf.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"specOf.js","sourceRoot":"","sources":["../../src/indexer/specOf.ts"],"names":[],"mappings":";;;AAEA,qDAAkD;AAElD,gBAAuB,QAAuB;IAC5C,OAAO,+BAAc,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,KAAK,QAAQ,CAAC,CAAC;AACnE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./buildStaticGraph";
|
|
@@ -0,0 +1,18 @@
|
|
|
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./buildStaticGraph"), exports);
|
|
18
|
+
//# sourceMappingURL=staticIndexer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"staticIndexer.js","sourceRoot":"","sources":["../../src/indexer/staticIndexer.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,qDAAmC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.supertypesOf = supertypesOf;
|
|
4
|
+
function supertypesOf(rawDeclaration) {
|
|
5
|
+
const out = [];
|
|
6
|
+
const declaration = rawDeclaration.replace(/^\s*(?:(?:export|public|private|protected|internal|abstract|final|open|sealed|static|data)\s+)+/, "");
|
|
7
|
+
const extendsMatch = /\bextends\s+([^{]+?)(?:\bimplements\b|\bwith\b|\{|$)/.exec(declaration);
|
|
8
|
+
if (extendsMatch !== null)
|
|
9
|
+
for (const name of splitTypeList(extendsMatch[1]))
|
|
10
|
+
out.push({ name, relation: "extends" });
|
|
11
|
+
const implementsMatch = /\b(?:implements|with)\s+([^{]+?)(?:\{|$)/.exec(declaration);
|
|
12
|
+
if (implementsMatch !== null)
|
|
13
|
+
for (const name of splitTypeList(implementsMatch[1]))
|
|
14
|
+
out.push({ name, relation: "implements" });
|
|
15
|
+
const pythonMatch = /^class\s+\w+\s*\(([^)]*)\)/.exec(declaration);
|
|
16
|
+
if (pythonMatch !== null)
|
|
17
|
+
for (const name of splitTypeList(pythonMatch[1]))
|
|
18
|
+
out.push({ name, relation: "extends" });
|
|
19
|
+
const rubyMatch = /^class\s+\w+\s*<\s*([A-Za-z_][\w.]*)/.exec(declaration);
|
|
20
|
+
if (rubyMatch !== null)
|
|
21
|
+
out.push({ name: rubyMatch[1], relation: "extends" });
|
|
22
|
+
if (out.length === 0) {
|
|
23
|
+
const colonMatch = /^(?:class|struct|interface)\s+\w+\s*:\s*([^{]+)/.exec(declaration);
|
|
24
|
+
if (colonMatch !== null)
|
|
25
|
+
for (const name of splitTypeList(colonMatch[1]))
|
|
26
|
+
out.push({ name, relation: "extends" });
|
|
27
|
+
}
|
|
28
|
+
return out;
|
|
29
|
+
}
|
|
30
|
+
function splitTypeList(text) {
|
|
31
|
+
const names = [];
|
|
32
|
+
for (const part of text.split(",")) {
|
|
33
|
+
// Skip Python keyword-argument bases (`metaclass=Meta`) and `*args`/`**kw`
|
|
34
|
+
// unpacking, which are not supertypes.
|
|
35
|
+
if (part.includes("=") || part.trim().startsWith("*"))
|
|
36
|
+
continue;
|
|
37
|
+
const cleaned = part
|
|
38
|
+
.trim()
|
|
39
|
+
.replace(/^(?:public|private|protected|virtual|final|open|sealed|abstract)\s+/, "")
|
|
40
|
+
.replace(/<[^>]*>/g, "")
|
|
41
|
+
.replace(/\(.*$/, "");
|
|
42
|
+
const match = /^[A-Za-z_][\w.]*/.exec(cleaned.trim());
|
|
43
|
+
if (match !== null)
|
|
44
|
+
names.push(match[0]);
|
|
45
|
+
}
|
|
46
|
+
return names;
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=supertypesOf.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"supertypesOf.js","sourceRoot":"","sources":["../../src/indexer/supertypesOf.ts"],"names":[],"mappings":";;;AAAA,sBACE,cAAsB;IAEtB,MAAM,GAAG,GAAgE,EAAE,CAAC;IAC5E,MAAM,WAAW,GAAG,cAAc,CAAC,OAAO,CACxC,iGAAiG,EACjG,EAAE,CACH,CAAC;IACF,MAAM,YAAY,GAAG,sDAAsD,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IAC9F,IAAI,YAAY,KAAK,IAAI;QACvB,KAAK,MAAM,IAAI,IAAI,aAAa,CAAC,YAAY,CAAC,CAAC,CAAE,CAAC;YAAE,GAAG,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC,CAAC;IAC9F,MAAM,eAAe,GAAG,0CAA0C,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IACrF,IAAI,eAAe,KAAK,IAAI;QAC1B,KAAK,MAAM,IAAI,IAAI,aAAa,CAAC,eAAe,CAAC,CAAC,CAAE,CAAC;YAAE,GAAG,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,YAAY,EAAE,CAAC,CAAC;IACpG,MAAM,WAAW,GAAG,4BAA4B,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IACnE,IAAI,WAAW,KAAK,IAAI;QACtB,KAAK,MAAM,IAAI,IAAI,aAAa,CAAC,WAAW,CAAC,CAAC,CAAE,CAAC;YAAE,GAAG,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC,CAAC;IAC7F,MAAM,SAAS,GAAG,sCAAsC,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IAC3E,IAAI,SAAS,KAAK,IAAI;QAA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umentSymbolResult.js","sourceRoot":"","sources":["../../src/lsp/DocumentSymbolResult.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IDiagnostic.js","sourceRoot":"","sources":["../../src/lsp/IDiagnostic.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IDocumentSymbol.js","sourceRoot":"","sources":["../../src/lsp/IDocumentSymbol.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ILocation.js","sourceRoot":"","sources":["../../src/lsp/ILocation.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IPosition.js","sourceRoot":"","sources":["../../src/lsp/IPosition.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IRange.js","sourceRoot":"","sources":["../../src/lsp/IRange.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ISymbolInformation.js","sourceRoot":"","sources":["../../src/lsp/ISymbolInformation.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export declare class LspClient {
|
|
2
|
+
private readonly timeoutMs;
|
|
3
|
+
private readonly process;
|
|
4
|
+
private readonly pending;
|
|
5
|
+
private readonly events;
|
|
6
|
+
private buffer;
|
|
7
|
+
private nextId;
|
|
8
|
+
constructor(command: string, args: readonly string[], timeoutMs: number);
|
|
9
|
+
request<T>(method: string, params: unknown, timeoutMs?: number): Promise<T>;
|
|
10
|
+
notify(method: string, params: unknown): void;
|
|
11
|
+
onNotification(method: string, listener: (params: unknown) => void): void;
|
|
12
|
+
close(): Promise<void>;
|
|
13
|
+
private write;
|
|
14
|
+
private onData;
|
|
15
|
+
private handleMessage;
|
|
16
|
+
private rejectAll;
|
|
17
|
+
}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LspClient = void 0;
|
|
4
|
+
const node_child_process_1 = require("node:child_process");
|
|
5
|
+
const node_events_1 = require("node:events");
|
|
6
|
+
class LspClient {
|
|
7
|
+
timeoutMs;
|
|
8
|
+
process;
|
|
9
|
+
pending = new Map();
|
|
10
|
+
events = new node_events_1.EventEmitter();
|
|
11
|
+
buffer = Buffer.alloc(0);
|
|
12
|
+
nextId = 1;
|
|
13
|
+
constructor(command, args, timeoutMs) {
|
|
14
|
+
this.timeoutMs = timeoutMs;
|
|
15
|
+
this.process = (0, node_child_process_1.spawn)(command, [...args], {
|
|
16
|
+
stdio: "pipe",
|
|
17
|
+
windowsHide: true,
|
|
18
|
+
});
|
|
19
|
+
this.process.stdout.on("data", (chunk) => this.onData(chunk));
|
|
20
|
+
this.process.stderr.on("data", () => {
|
|
21
|
+
// Language servers often log noisy progress to stderr.
|
|
22
|
+
});
|
|
23
|
+
this.process.on("error", (error) => this.rejectAll(error));
|
|
24
|
+
this.process.on("exit", (code, signal) => {
|
|
25
|
+
this.rejectAll(new Error(`Language server exited (${code ?? "null"}, ${signal ?? "null"}).`));
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
async request(method, params, timeoutMs) {
|
|
29
|
+
const id = this.nextId++;
|
|
30
|
+
const payload = { jsonrpc: "2.0", id, method, params };
|
|
31
|
+
const promise = new Promise((resolve, reject) => {
|
|
32
|
+
const timer = setTimeout(() => {
|
|
33
|
+
this.pending.delete(id);
|
|
34
|
+
reject(new Error(`LSP request timed out: ${method}`));
|
|
35
|
+
}, timeoutMs ?? this.timeoutMs);
|
|
36
|
+
this.pending.set(id, {
|
|
37
|
+
resolve: (value) => resolve(value),
|
|
38
|
+
reject,
|
|
39
|
+
timer,
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
this.write(payload);
|
|
43
|
+
return promise;
|
|
44
|
+
}
|
|
45
|
+
notify(method, params) {
|
|
46
|
+
this.write({ jsonrpc: "2.0", method, params });
|
|
47
|
+
}
|
|
48
|
+
onNotification(method, listener) {
|
|
49
|
+
this.events.on(method, listener);
|
|
50
|
+
}
|
|
51
|
+
async close() {
|
|
52
|
+
try {
|
|
53
|
+
await this.request("shutdown", null);
|
|
54
|
+
}
|
|
55
|
+
catch {
|
|
56
|
+
// Some servers exit before answering shutdown.
|
|
57
|
+
}
|
|
58
|
+
/* c8 ignore start */
|
|
59
|
+
try {
|
|
60
|
+
this.notify("exit", null);
|
|
61
|
+
}
|
|
62
|
+
catch {
|
|
63
|
+
// Ignore close errors.
|
|
64
|
+
}
|
|
65
|
+
/* c8 ignore stop */
|
|
66
|
+
if (!this.process.killed)
|
|
67
|
+
this.process.kill();
|
|
68
|
+
}
|
|
69
|
+
write(payload) {
|
|
70
|
+
const body = Buffer.from(JSON.stringify(payload), "utf8");
|
|
71
|
+
const header = Buffer.from(`Content-Length: ${body.length}\r\n\r\n`, "ascii");
|
|
72
|
+
this.process.stdin.write(Buffer.concat([header, body]));
|
|
73
|
+
}
|
|
74
|
+
onData(chunk) {
|
|
75
|
+
this.buffer = Buffer.concat([this.buffer, chunk]);
|
|
76
|
+
for (;;) {
|
|
77
|
+
const headerEnd = this.buffer.indexOf("\r\n\r\n");
|
|
78
|
+
if (headerEnd < 0)
|
|
79
|
+
return;
|
|
80
|
+
const header = this.buffer.slice(0, headerEnd).toString("ascii");
|
|
81
|
+
const match = /Content-Length:\s*(\d+)/i.exec(header);
|
|
82
|
+
if (match === null) {
|
|
83
|
+
this.buffer = this.buffer.slice(headerEnd + 4);
|
|
84
|
+
continue;
|
|
85
|
+
}
|
|
86
|
+
const length = Number(match[1]);
|
|
87
|
+
const bodyStart = headerEnd + 4;
|
|
88
|
+
const bodyEnd = bodyStart + length;
|
|
89
|
+
if (this.buffer.length < bodyEnd)
|
|
90
|
+
return;
|
|
91
|
+
const body = this.buffer.slice(bodyStart, bodyEnd).toString("utf8");
|
|
92
|
+
this.buffer = this.buffer.slice(bodyEnd);
|
|
93
|
+
// A malformed frame must not throw out of the stdout `data` listener as an
|
|
94
|
+
// uncaught exception; drop it and keep draining the buffer.
|
|
95
|
+
let message;
|
|
96
|
+
try {
|
|
97
|
+
message = JSON.parse(body);
|
|
98
|
+
}
|
|
99
|
+
catch {
|
|
100
|
+
continue;
|
|
101
|
+
}
|
|
102
|
+
this.handleMessage(message);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
handleMessage(message) {
|
|
106
|
+
// A server-initiated request carries both an id and a method. It must be
|
|
107
|
+
// answered or some servers block: gopls, for instance, withholds
|
|
108
|
+
// documentSymbol until its `window/workDoneProgress/create` request is
|
|
109
|
+
// acknowledged. A null result satisfies the acknowledgements we advertise.
|
|
110
|
+
if (message.id !== undefined && message.method !== undefined) {
|
|
111
|
+
this.write({ jsonrpc: "2.0", id: message.id, result: null });
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
if (message.id !== undefined) {
|
|
115
|
+
const pending = this.pending.get(message.id);
|
|
116
|
+
if (pending === undefined)
|
|
117
|
+
return;
|
|
118
|
+
this.pending.delete(message.id);
|
|
119
|
+
clearTimeout(pending.timer);
|
|
120
|
+
if (message.error !== undefined) {
|
|
121
|
+
pending.reject(new Error(message.error.message ?? "LSP request failed."));
|
|
122
|
+
}
|
|
123
|
+
else {
|
|
124
|
+
pending.resolve(message.result);
|
|
125
|
+
}
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
if (message.method !== undefined)
|
|
129
|
+
this.events.emit(message.method, message.params);
|
|
130
|
+
}
|
|
131
|
+
rejectAll(error) {
|
|
132
|
+
for (const [id, request] of this.pending) {
|
|
133
|
+
this.pending.delete(id);
|
|
134
|
+
clearTimeout(request.timer);
|
|
135
|
+
request.reject(error);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
exports.LspClient = LspClient;
|
|
140
|
+
//# sourceMappingURL=LspClient.js.map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,SAAS;gBAAE,OAAO;YAClC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;YAChC,YAAY,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;YAC5B,IAAI,OAAO,CAAC,KAAK,KAAK,SAAS,EAAE,CAAC;gBAChC,OAAO,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,IAAI,qBAAqB,CAAC,CAAC,CAAC;YAC5E,CAAC;iBAAM,CAAC;gBACN,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;YAClC,CAAC;YACD,OAAO;QACT,CAAC;QACD,IAAI,OAAO,CAAC,MAAM,KAAK,SAAS;YAAE,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;IACrF,CAAC;IAEO,SAAS,CAAC,KAAY;QAC5B,KAAK,MAAM,CAAC,EAAE,EAAE,OAAO,CAAC,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;YACzC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;YACxB,YAAY,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;YAC5B,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACxB,CAAC;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isDocumentSymbol.js","sourceRoot":"","sources":["../../src/lsp/isDocumentSymbol.ts"],"names":[],"mappings":";;;AAGA,0BACE,KAA2C;IAE3C,OAAO,gBAAgB,IAAI,KAAK,CAAC;AACnC,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export * from "./DocumentSymbolResult";
|
|
2
|
+
export * from "./IDiagnostic";
|
|
3
|
+
export * from "./IDocumentSymbol";
|
|
4
|
+
export * from "./ILocation";
|
|
5
|
+
export * from "./IPosition";
|
|
6
|
+
export * from "./IRange";
|
|
7
|
+
export * from "./ISymbolInformation";
|
|
8
|
+
export * from "./isDocumentSymbol";
|
package/lib/lsp/types.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./DocumentSymbolResult"), exports);
|
|
18
|
+
__exportStar(require("./IDiagnostic"), exports);
|
|
19
|
+
__exportStar(require("./IDocumentSymbol"), exports);
|
|
20
|
+
__exportStar(require("./ILocation"), exports);
|
|
21
|
+
__exportStar(require("./IPosition"), exports);
|
|
22
|
+
__exportStar(require("./IRange"), exports);
|
|
23
|
+
__exportStar(require("./ISymbolInformation"), exports);
|
|
24
|
+
__exportStar(require("./isDocumentSymbol"), exports);
|
|
25
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/lsp/types.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,yDAAuC;AACvC,gDAA8B;AAC9B,oDAAkC;AAClC,8CAA4B;AAC5B,8CAA4B;AAC5B,2CAAyB;AACzB,uDAAqC;AACrC,qDAAmC"}
|