Files
modeling-app/rust/kcl-lib/tests/artifact_graph_example_code1/ast.snap
Nick Cameron df278c7e6a Various hover improvements (#5617)
* Show more info on hover for variables

Signed-off-by: Nick Cameron <nrc@ncameron.org>

* Move hover impls to lsp module

Signed-off-by: Nick Cameron <nrc@ncameron.org>

* Make hover work on names inside calls, fix doc line breaking, trim docs in tool tips

Signed-off-by: Nick Cameron <nrc@ncameron.org>

* Test the new hovers; fix signature syntax

Signed-off-by: Nick Cameron <nrc@ncameron.org>

* Hover tips for kwargs

Signed-off-by: Nick Cameron <nrc@ncameron.org>

---------

Signed-off-by: Nick Cameron <nrc@ncameron.org>
2025-03-04 09:53:31 +00:00

921 lines
29 KiB
Plaintext

---
source: kcl-lib/src/simulation_tests.rs
description: Result of parsing artifact_graph_example_code1.kcl
---
{
"Ok": {
"body": [
{
"declaration": {
"end": 246,
"id": {
"end": 9,
"name": "sketch001",
"start": 0,
"type": "Identifier"
},
"init": {
"body": [
{
"arguments": [
{
"end": 30,
"raw": "'XY'",
"start": 26,
"type": "Literal",
"type": "Literal",
"value": "XY"
}
],
"callee": {
"end": 25,
"name": "startSketchOn",
"start": 12,
"type": "Identifier"
},
"end": 31,
"start": 12,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"elements": [
{
"argument": {
"end": 55,
"raw": "5",
"start": 54,
"type": "Literal",
"type": "Literal",
"value": {
"value": 5.0,
"suffix": "None"
}
},
"end": 55,
"operator": "-",
"start": 53,
"type": "UnaryExpression",
"type": "UnaryExpression"
},
{
"argument": {
"end": 59,
"raw": "5",
"start": 58,
"type": "Literal",
"type": "Literal",
"value": {
"value": 5.0,
"suffix": "None"
}
},
"end": 59,
"operator": "-",
"start": 57,
"type": "UnaryExpression",
"type": "UnaryExpression"
}
],
"end": 60,
"start": 52,
"type": "ArrayExpression",
"type": "ArrayExpression"
},
{
"end": 63,
"start": 62,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 51,
"name": "startProfileAt",
"start": 37,
"type": "Identifier"
},
"end": 64,
"start": 37,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"type": "LabeledArg",
"label": {
"end": 78,
"name": "end",
"start": 75,
"type": "Identifier"
},
"arg": {
"elements": [
{
"end": 83,
"raw": "0",
"start": 82,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.0,
"suffix": "None"
}
},
{
"end": 87,
"raw": "10",
"start": 85,
"type": "Literal",
"type": "Literal",
"value": {
"value": 10.0,
"suffix": "None"
}
}
],
"end": 88,
"start": 81,
"type": "ArrayExpression",
"type": "ArrayExpression"
}
}
],
"callee": {
"end": 74,
"name": "line",
"start": 70,
"type": "Identifier"
},
"end": 89,
"start": 70,
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": null
},
{
"arguments": [
{
"type": "LabeledArg",
"label": {
"end": 103,
"name": "end",
"start": 100,
"type": "Identifier"
},
"arg": {
"elements": [
{
"end": 112,
"raw": "10.55",
"start": 107,
"type": "Literal",
"type": "Literal",
"value": {
"value": 10.55,
"suffix": "None"
}
},
{
"end": 115,
"raw": "0",
"start": 114,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.0,
"suffix": "None"
}
}
],
"end": 116,
"start": 106,
"type": "ArrayExpression",
"type": "ArrayExpression"
}
},
{
"type": "LabeledArg",
"label": {
"end": 121,
"name": "tag",
"start": 118,
"type": "Identifier"
},
"arg": {
"end": 130,
"start": 124,
"type": "TagDeclarator",
"type": "TagDeclarator",
"value": "seg01"
}
}
],
"callee": {
"end": 99,
"name": "line",
"start": 95,
"type": "Identifier"
},
"end": 131,
"start": 95,
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": null
},
{
"arguments": [
{
"type": "LabeledArg",
"label": {
"end": 145,
"name": "end",
"start": 142,
"type": "Identifier"
},
"arg": {
"elements": [
{
"end": 150,
"raw": "0",
"start": 149,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.0,
"suffix": "None"
}
},
{
"argument": {
"end": 155,
"raw": "10",
"start": 153,
"type": "Literal",
"type": "Literal",
"value": {
"value": 10.0,
"suffix": "None"
}
},
"end": 155,
"operator": "-",
"start": 152,
"type": "UnaryExpression",
"type": "UnaryExpression"
}
],
"end": 156,
"start": 148,
"type": "ArrayExpression",
"type": "ArrayExpression"
}
},
{
"type": "LabeledArg",
"label": {
"end": 161,
"name": "tag",
"start": 158,
"type": "Identifier"
},
"arg": {
"end": 170,
"start": 164,
"type": "TagDeclarator",
"type": "TagDeclarator",
"value": "seg02"
}
}
],
"callee": {
"end": 141,
"name": "line",
"start": 137,
"type": "Identifier"
},
"end": 171,
"start": 137,
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": null
},
{
"arguments": [
{
"type": "LabeledArg",
"label": {
"end": 193,
"name": "endAbsolute",
"start": 182,
"type": "Identifier"
},
"arg": {
"elements": [
{
"arguments": [
{
"end": 212,
"start": 211,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 210,
"name": "profileStartX",
"start": 197,
"type": "Identifier"
},
"end": 213,
"start": 197,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"end": 230,
"start": 229,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 228,
"name": "profileStartY",
"start": 215,
"type": "Identifier"
},
"end": 231,
"start": 215,
"type": "CallExpression",
"type": "CallExpression"
}
],
"end": 232,
"start": 196,
"type": "ArrayExpression",
"type": "ArrayExpression"
}
}
],
"callee": {
"end": 181,
"name": "line",
"start": 177,
"type": "Identifier"
},
"end": 233,
"start": 177,
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": null
},
{
"arguments": [],
"callee": {
"end": 244,
"name": "close",
"start": 239,
"type": "Identifier"
},
"end": 246,
"start": 239,
"type": "CallExpression",
"type": "CallExpression"
}
],
"end": 246,
"start": 12,
"type": "PipeExpression",
"type": "PipeExpression"
},
"start": 0,
"type": "VariableDeclarator"
},
"end": 246,
"kind": "const",
"start": 0,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"declaration": {
"end": 332,
"id": {
"end": 257,
"name": "extrude001",
"start": 247,
"type": "Identifier"
},
"init": {
"body": [
{
"arguments": [
{
"type": "LabeledArg",
"label": {
"end": 285,
"name": "length",
"start": 279,
"type": "Identifier"
},
"arg": {
"argument": {
"end": 291,
"raw": "10",
"start": 289,
"type": "Literal",
"type": "Literal",
"value": {
"value": 10.0,
"suffix": "None"
}
},
"end": 291,
"operator": "-",
"start": 288,
"type": "UnaryExpression",
"type": "UnaryExpression"
}
}
],
"callee": {
"end": 267,
"name": "extrude",
"start": 260,
"type": "Identifier"
},
"end": 292,
"start": 260,
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": {
"end": 277,
"name": "sketch001",
"start": 268,
"type": "Identifier",
"type": "Identifier"
}
},
{
"arguments": [
{
"type": "LabeledArg",
"label": {
"end": 311,
"name": "radius",
"start": 305,
"type": "Identifier"
},
"arg": {
"end": 315,
"raw": "5",
"start": 314,
"type": "Literal",
"type": "Literal",
"value": {
"value": 5.0,
"suffix": "None"
}
}
},
{
"type": "LabeledArg",
"label": {
"end": 321,
"name": "tags",
"start": 317,
"type": "Identifier"
},
"arg": {
"elements": [
{
"end": 330,
"name": "seg01",
"start": 325,
"type": "Identifier",
"type": "Identifier"
}
],
"end": 331,
"start": 324,
"type": "ArrayExpression",
"type": "ArrayExpression"
}
}
],
"callee": {
"end": 304,
"name": "fillet",
"start": 298,
"type": "Identifier"
},
"end": 332,
"start": 298,
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": null
}
],
"end": 332,
"start": 260,
"type": "PipeExpression",
"type": "PipeExpression"
},
"start": 247,
"type": "VariableDeclarator"
},
"end": 332,
"kind": "const",
"start": 247,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"declaration": {
"end": 534,
"id": {
"end": 342,
"name": "sketch002",
"start": 333,
"type": "Identifier"
},
"init": {
"body": [
{
"arguments": [
{
"end": 369,
"name": "extrude001",
"start": 359,
"type": "Identifier",
"type": "Identifier"
},
{
"end": 376,
"name": "seg02",
"start": 371,
"type": "Identifier",
"type": "Identifier"
}
],
"callee": {
"end": 358,
"name": "startSketchOn",
"start": 345,
"type": "Identifier"
},
"end": 377,
"start": 345,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"elements": [
{
"argument": {
"end": 401,
"raw": "2",
"start": 400,
"type": "Literal",
"type": "Literal",
"value": {
"value": 2.0,
"suffix": "None"
}
},
"end": 401,
"operator": "-",
"start": 399,
"type": "UnaryExpression",
"type": "UnaryExpression"
},
{
"argument": {
"end": 405,
"raw": "6",
"start": 404,
"type": "Literal",
"type": "Literal",
"value": {
"value": 6.0,
"suffix": "None"
}
},
"end": 405,
"operator": "-",
"start": 403,
"type": "UnaryExpression",
"type": "UnaryExpression"
}
],
"end": 406,
"start": 398,
"type": "ArrayExpression",
"type": "ArrayExpression"
},
{
"end": 409,
"start": 408,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 397,
"name": "startProfileAt",
"start": 383,
"type": "Identifier"
},
"end": 410,
"start": 383,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"type": "LabeledArg",
"label": {
"end": 424,
"name": "end",
"start": 421,
"type": "Identifier"
},
"arg": {
"elements": [
{
"end": 429,
"raw": "2",
"start": 428,
"type": "Literal",
"type": "Literal",
"value": {
"value": 2.0,
"suffix": "None"
}
},
{
"end": 432,
"raw": "3",
"start": 431,
"type": "Literal",
"type": "Literal",
"value": {
"value": 3.0,
"suffix": "None"
}
}
],
"end": 433,
"start": 427,
"type": "ArrayExpression",
"type": "ArrayExpression"
}
}
],
"callee": {
"end": 420,
"name": "line",
"start": 416,
"type": "Identifier"
},
"end": 434,
"start": 416,
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": null
},
{
"arguments": [
{
"type": "LabeledArg",
"label": {
"end": 448,
"name": "end",
"start": 445,
"type": "Identifier"
},
"arg": {
"elements": [
{
"end": 453,
"raw": "2",
"start": 452,
"type": "Literal",
"type": "Literal",
"value": {
"value": 2.0,
"suffix": "None"
}
},
{
"argument": {
"end": 457,
"raw": "3",
"start": 456,
"type": "Literal",
"type": "Literal",
"value": {
"value": 3.0,
"suffix": "None"
}
},
"end": 457,
"operator": "-",
"start": 455,
"type": "UnaryExpression",
"type": "UnaryExpression"
}
],
"end": 458,
"start": 451,
"type": "ArrayExpression",
"type": "ArrayExpression"
}
}
],
"callee": {
"end": 444,
"name": "line",
"start": 440,
"type": "Identifier"
},
"end": 459,
"start": 440,
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": null
},
{
"arguments": [
{
"type": "LabeledArg",
"label": {
"end": 481,
"name": "endAbsolute",
"start": 470,
"type": "Identifier"
},
"arg": {
"elements": [
{
"arguments": [
{
"end": 500,
"start": 499,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 498,
"name": "profileStartX",
"start": 485,
"type": "Identifier"
},
"end": 501,
"start": 485,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"end": 518,
"start": 517,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 516,
"name": "profileStartY",
"start": 503,
"type": "Identifier"
},
"end": 519,
"start": 503,
"type": "CallExpression",
"type": "CallExpression"
}
],
"end": 520,
"start": 484,
"type": "ArrayExpression",
"type": "ArrayExpression"
}
}
],
"callee": {
"end": 469,
"name": "line",
"start": 465,
"type": "Identifier"
},
"end": 521,
"start": 465,
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": null
},
{
"arguments": [],
"callee": {
"end": 532,
"name": "close",
"start": 527,
"type": "Identifier"
},
"end": 534,
"start": 527,
"type": "CallExpression",
"type": "CallExpression"
}
],
"end": 534,
"start": 345,
"type": "PipeExpression",
"type": "PipeExpression"
},
"start": 333,
"type": "VariableDeclarator"
},
"end": 534,
"kind": "const",
"start": 333,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"declaration": {
"end": 578,
"id": {
"end": 545,
"name": "extrude002",
"start": 535,
"type": "Identifier"
},
"init": {
"arguments": [
{
"type": "LabeledArg",
"label": {
"end": 573,
"name": "length",
"start": 567,
"type": "Identifier"
},
"arg": {
"end": 577,
"raw": "5",
"start": 576,
"type": "Literal",
"type": "Literal",
"value": {
"value": 5.0,
"suffix": "None"
}
}
}
],
"callee": {
"end": 555,
"name": "extrude",
"start": 548,
"type": "Identifier"
},
"end": 578,
"start": 548,
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": {
"end": 565,
"name": "sketch002",
"start": 556,
"type": "Identifier",
"type": "Identifier"
}
},
"start": 535,
"type": "VariableDeclarator"
},
"end": 578,
"kind": "const",
"start": 535,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
}
],
"end": 579,
"start": 0
}
}