dot-language-support
Advanced tools
Comparing version 1.1.6 to 1.1.7
@@ -13,2 +13,2 @@ import { SyntaxNode, Identifier, SyntaxKind, Graph, EdgeStatement, EdgeRhs, SourceFile, SubGraphStatement, NodeId, AttributeStatement, Statement, StatementOf, Token } from "./types"; | ||
export declare function edgeStatementHasAttributes(es: EdgeStatement): boolean; | ||
export declare function getIdentifierText(n: Identifier): string | undefined; | ||
export declare function getIdentifierText(n: Identifier): string; |
@@ -7,2 +7,3 @@ "use strict"; | ||
const util_1 = require("./util"); | ||
const common_1 = require("./command/common"); | ||
function hover(doc, sourceFile, position) { | ||
@@ -69,2 +70,4 @@ const offset = doc.offsetAt(position); | ||
} | ||
case types_1.SyntaxKind.EdgeRhs: | ||
return getEdgeHover(parent); | ||
} | ||
@@ -86,2 +89,5 @@ return types_1.SyntaxKind[parent.kind]; | ||
return getGraphHover(n); | ||
case types_1.SyntaxKind.DirectedEdgeOp: | ||
case types_1.SyntaxKind.UndirectedEdgeOp: | ||
return getEdgeHover(n.parent); | ||
default: | ||
@@ -99,2 +105,26 @@ return undefined; | ||
} | ||
function getEdgeHover(n) { | ||
const p = n.parent; | ||
if (!p || p.rhs.length === 0) | ||
return undefined; | ||
let source = undefined; | ||
for (const curr of p.rhs) { | ||
if (curr === n) | ||
break; | ||
source = curr.target; | ||
} | ||
if (source === undefined) | ||
source = p.source; | ||
const edgeOpStr = common_1.getEdgeStr(n.operation.kind); | ||
return source === undefined | ||
? undefined | ||
: `(edge) ${getEdgeSourceOrTargetText(source)} ${edgeOpStr} ${getEdgeSourceOrTargetText(n.target)}`; | ||
} | ||
function getEdgeSourceOrTargetText(n) { | ||
return n.kind === types_1.SyntaxKind.NodeId | ||
? checker_1.getIdentifierText(n.id) | ||
: n.id !== undefined | ||
? `${checker_1.getIdentifierText(n.id)}` | ||
: "sub graph"; | ||
} | ||
//# sourceMappingURL=hover.js.map |
{ | ||
"name": "dot-language-support", | ||
"version": "1.1.6", | ||
"version": "1.1.7", | ||
"description": "Parser and language service for graphviz (dot) files", | ||
@@ -11,3 +11,3 @@ "author": "Niklas Mollenhauer", | ||
"test": "mocha -r ts-node/register tests/**/*.spec.ts tests/*.spec.ts", | ||
"clean": "rm -rv -- lib/* || true", | ||
"clean": "rimraf lib", | ||
"compile": "tsc", | ||
@@ -36,2 +36,3 @@ "prepare": "npm run compile" | ||
"mocha": "^5.2.0", | ||
"rimraf": "^2.6.2", | ||
"ts-node": "^6.0.5", | ||
@@ -38,0 +39,0 @@ "typescript": "^2.9.1", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
157805
4285
8