dot-language-support 4.3.0 → 4.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.mjs +75 -4
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1694,6 +1694,54 @@ const attributes = Array.from(new Set([
|
|
|
1694
1694
|
...graphAttributes,
|
|
1695
1695
|
...clusterAttributes
|
|
1696
1696
|
])).sort();
|
|
1697
|
+
const attributeDescriptions = Object.freeze({
|
|
1698
|
+
arrowhead: "Style of arrowhead at head end",
|
|
1699
|
+
arrowsize: "Scaling factor for arrowheads",
|
|
1700
|
+
arrowtail: "Style of arrowhead at tail end",
|
|
1701
|
+
bgcolor: "Background color",
|
|
1702
|
+
color: "Node shape/edge/cluster color",
|
|
1703
|
+
comment: "Any string",
|
|
1704
|
+
compound: "Allow edges between clusters",
|
|
1705
|
+
concentrate: "Enables edge concentrators",
|
|
1706
|
+
constraint: "Use edge to affect node ranking",
|
|
1707
|
+
decorate: "If set, line between label and edge",
|
|
1708
|
+
dir: "Direction of edge",
|
|
1709
|
+
distortion: "Node distortion",
|
|
1710
|
+
fillcolor: "Node/cluster fill color",
|
|
1711
|
+
fixedsize: "Label text has no effect on node size",
|
|
1712
|
+
fontcolor: "Font face color",
|
|
1713
|
+
fontname: "Font family",
|
|
1714
|
+
fontsize: "Point size of label",
|
|
1715
|
+
group: "Name of node group",
|
|
1716
|
+
headlabel: "Label placed near head of edge",
|
|
1717
|
+
headport: "Where on the node to attach head of edge",
|
|
1718
|
+
height: "Height in inches",
|
|
1719
|
+
label: "Any string",
|
|
1720
|
+
labelangle: "Angle in degrees",
|
|
1721
|
+
labeldistance: "Scaling factor for distance for head or tail label",
|
|
1722
|
+
labelfontcolor: "Type face color for head and tail labels",
|
|
1723
|
+
labelfontname: "Font family for head and tail labels",
|
|
1724
|
+
labelfontsize: "Point size for head and tail labels",
|
|
1725
|
+
labeljust: "Label justification",
|
|
1726
|
+
labelloc: "Label vertical justification",
|
|
1727
|
+
layer: "Overlay range",
|
|
1728
|
+
nodesep: "Separation between nodes, in inches",
|
|
1729
|
+
orientation: "Node rotation angle",
|
|
1730
|
+
peripheries: "Number of node boundaries",
|
|
1731
|
+
ranksep: "Separation between ranks, in inches",
|
|
1732
|
+
ratio: "Aspect ratio",
|
|
1733
|
+
regular: "Force polygon to be regular",
|
|
1734
|
+
rotate: "If 90, set orientation to landscape",
|
|
1735
|
+
shape: "Node shape",
|
|
1736
|
+
shapefile: "External custom shape file",
|
|
1737
|
+
sides: "Number of sides for shape=polygon",
|
|
1738
|
+
skew: "Skewing node for shape=polygon",
|
|
1739
|
+
style: "Graphics options",
|
|
1740
|
+
taillabel: "Label placed near tail of edge",
|
|
1741
|
+
tailport: "Where on the node to attach tail of edge",
|
|
1742
|
+
weight: "Integer cost of stretching an edge",
|
|
1743
|
+
width: "Width in inches"
|
|
1744
|
+
});
|
|
1697
1745
|
/**
|
|
1698
1746
|
* We only support the X11 color scheme
|
|
1699
1747
|
*/
|
|
@@ -3239,6 +3287,7 @@ function getAttributeCompletions(posistion) {
|
|
|
3239
3287
|
return attributes.map((label) => ({
|
|
3240
3288
|
kind,
|
|
3241
3289
|
label,
|
|
3290
|
+
documentation: attributeDescriptions[label.toLowerCase()],
|
|
3242
3291
|
textEdit: {
|
|
3243
3292
|
range,
|
|
3244
3293
|
newText: `${escapeIdentifierText(label)}=`
|
|
@@ -3310,8 +3359,12 @@ function getHoverContents(n) {
|
|
|
3310
3359
|
return { contents: `(node) ${getIdentifierText(n)}` };
|
|
3311
3360
|
case syntaxKind.Assignment: {
|
|
3312
3361
|
const assignment = parent;
|
|
3362
|
+
const left = getIdentifierText(assignment.leftId);
|
|
3363
|
+
const right = getIdentifierText(assignment.rightId);
|
|
3364
|
+
const desc = attributeDescriptions[left.toLowerCase()];
|
|
3365
|
+
const base = `(assignment) \`${left}\` = \`${right}\``;
|
|
3313
3366
|
return {
|
|
3314
|
-
contents:
|
|
3367
|
+
contents: desc ? `${base}\n\n${desc}` : base,
|
|
3315
3368
|
range: {
|
|
3316
3369
|
pos: assignment.pos,
|
|
3317
3370
|
end: assignment.end
|
|
@@ -3343,8 +3396,12 @@ function getHoverContents(n) {
|
|
|
3343
3396
|
}
|
|
3344
3397
|
case syntaxKind.IdEqualsIdStatement: {
|
|
3345
3398
|
const idEqId = parent;
|
|
3399
|
+
const left = getIdentifierText(idEqId.leftId);
|
|
3400
|
+
const right = getIdentifierText(idEqId.rightId);
|
|
3401
|
+
const desc = attributeDescriptions[left.toLowerCase()];
|
|
3402
|
+
const base = `(graph property) \`${left}\` = \`${right}\``;
|
|
3346
3403
|
return {
|
|
3347
|
-
contents:
|
|
3404
|
+
contents: desc ? `${base}\n\n${desc}` : base,
|
|
3348
3405
|
range: {
|
|
3349
3406
|
pos: idEqId.pos,
|
|
3350
3407
|
end: idEqId.end
|
|
@@ -3449,9 +3506,23 @@ function findDefinition(doc, sourceFile, position) {
|
|
|
3449
3506
|
range
|
|
3450
3507
|
};
|
|
3451
3508
|
}
|
|
3452
|
-
debugger;
|
|
3453
3509
|
}
|
|
3454
|
-
|
|
3510
|
+
function findDeclaration(doc, sourceFile, position) {
|
|
3511
|
+
if (!sourceFile.symbols) throw "sourceFile is not bound";
|
|
3512
|
+
const g = sourceFile.graph;
|
|
3513
|
+
if (!g) return;
|
|
3514
|
+
const node = findNodeAtOffset(g, doc.offsetAt(position));
|
|
3515
|
+
if (!node) return;
|
|
3516
|
+
if (!isIdentifierNode(node)) return;
|
|
3517
|
+
const nodeSymbol = node.symbol;
|
|
3518
|
+
if (!nodeSymbol) throw "node.symbol is not bound";
|
|
3519
|
+
const firstUse = nodeSymbol.firstMention;
|
|
3520
|
+
if (!firstUse) return;
|
|
3521
|
+
return {
|
|
3522
|
+
uri: doc.uri,
|
|
3523
|
+
range: syntaxNodeToRange(doc, sourceFile, firstUse)
|
|
3524
|
+
};
|
|
3525
|
+
}
|
|
3455
3526
|
//#endregion
|
|
3456
3527
|
//#region src/service/rename.ts
|
|
3457
3528
|
function renameSymbol(doc, sourceFile, position, newName) {
|