Files
modeling-app/rust/kcl-lib/tests/sketch_in_object/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

907 lines
34 KiB
Plaintext

---
source: kcl-lib/src/simulation_tests.rs
description: Result of parsing sketch_in_object.kcl
---
{
"Ok": {
"body": [
{
"declaration": {
"end": 170,
"id": {
"end": 7,
"name": "test",
"start": 3,
"type": "Identifier"
},
"init": {
"body": {
"body": [
{
"argument": {
"body": [
{
"arguments": [
{
"end": 39,
"raw": "'XY'",
"start": 35,
"type": "Literal",
"type": "Literal",
"value": "XY"
}
],
"callee": {
"end": 34,
"name": "startSketchOn",
"start": 21,
"type": "Identifier"
},
"end": 40,
"start": 21,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"elements": [
{
"end": 65,
"raw": "0",
"start": 64,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.0,
"suffix": "None"
}
},
{
"end": 68,
"raw": "0",
"start": 67,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.0,
"suffix": "None"
}
}
],
"end": 69,
"start": 63,
"type": "ArrayExpression",
"type": "ArrayExpression"
},
{
"end": 72,
"start": 71,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 62,
"name": "startProfileAt",
"start": 48,
"type": "Identifier"
},
"end": 73,
"start": 48,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"type": "LabeledArg",
"label": {
"end": 89,
"name": "end",
"start": 86,
"type": "Identifier"
},
"arg": {
"elements": [
{
"end": 94,
"raw": "0",
"start": 93,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.0,
"suffix": "None"
}
},
{
"end": 97,
"raw": "1",
"start": 96,
"type": "Literal",
"type": "Literal",
"value": {
"value": 1.0,
"suffix": "None"
}
}
],
"end": 98,
"start": 92,
"type": "ArrayExpression",
"type": "ArrayExpression"
}
}
],
"callee": {
"end": 85,
"name": "line",
"start": 81,
"type": "Identifier"
},
"end": 99,
"start": 81,
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": null
},
{
"arguments": [
{
"type": "LabeledArg",
"label": {
"end": 115,
"name": "end",
"start": 112,
"type": "Identifier"
},
"arg": {
"elements": [
{
"end": 120,
"raw": "1",
"start": 119,
"type": "Literal",
"type": "Literal",
"value": {
"value": 1.0,
"suffix": "None"
}
},
{
"end": 123,
"raw": "0",
"start": 122,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.0,
"suffix": "None"
}
}
],
"end": 124,
"start": 118,
"type": "ArrayExpression",
"type": "ArrayExpression"
}
}
],
"callee": {
"end": 111,
"name": "line",
"start": 107,
"type": "Identifier"
},
"end": 125,
"start": 107,
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": null
},
{
"arguments": [
{
"type": "LabeledArg",
"label": {
"end": 141,
"name": "end",
"start": 138,
"type": "Identifier"
},
"arg": {
"elements": [
{
"end": 146,
"raw": "0",
"start": 145,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.0,
"suffix": "None"
}
},
{
"argument": {
"end": 150,
"raw": "1",
"start": 149,
"type": "Literal",
"type": "Literal",
"value": {
"value": 1.0,
"suffix": "None"
}
},
"end": 150,
"operator": "-",
"start": 148,
"type": "UnaryExpression",
"type": "UnaryExpression"
}
],
"end": 151,
"start": 144,
"type": "ArrayExpression",
"type": "ArrayExpression"
}
}
],
"callee": {
"end": 137,
"name": "line",
"start": 133,
"type": "Identifier"
},
"end": 152,
"start": 133,
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": null
},
{
"arguments": [
{
"end": 167,
"start": 166,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 165,
"name": "close",
"start": 160,
"type": "Identifier"
},
"end": 168,
"start": 160,
"type": "CallExpression",
"type": "CallExpression"
}
],
"end": 168,
"start": 21,
"type": "PipeExpression",
"type": "PipeExpression"
},
"end": 168,
"start": 14,
"type": "ReturnStatement",
"type": "ReturnStatement"
}
],
"end": 170,
"start": 10
},
"end": 170,
"params": [],
"start": 7,
"type": "FunctionExpression",
"type": "FunctionExpression"
},
"start": 3,
"type": "VariableDeclarator"
},
"end": 170,
"kind": "fn",
"start": 0,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"declaration": {
"end": 405,
"id": {
"end": 180,
"name": "test2",
"start": 175,
"type": "Identifier"
},
"init": {
"body": {
"body": [
{
"argument": {
"end": 403,
"properties": [
{
"end": 399,
"key": {
"end": 206,
"name": "thing1",
"start": 200,
"type": "Identifier"
},
"start": 200,
"type": "ObjectProperty",
"value": {
"end": 399,
"properties": [
{
"end": 393,
"key": {
"end": 223,
"name": "thing2",
"start": 217,
"type": "Identifier"
},
"start": 217,
"type": "ObjectProperty",
"value": {
"body": [
{
"arguments": [
{
"end": 244,
"raw": "'XY'",
"start": 240,
"type": "Literal",
"type": "Literal",
"value": "XY"
}
],
"callee": {
"end": 239,
"name": "startSketchOn",
"start": 226,
"type": "Identifier"
},
"end": 245,
"start": 226,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"elements": [
{
"end": 274,
"raw": "0",
"start": 273,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.0,
"suffix": "None"
}
},
{
"end": 277,
"raw": "0",
"start": 276,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.0,
"suffix": "None"
}
}
],
"end": 278,
"start": 272,
"type": "ArrayExpression",
"type": "ArrayExpression"
},
{
"end": 281,
"start": 280,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 271,
"name": "startProfileAt",
"start": 257,
"type": "Identifier"
},
"end": 282,
"start": 257,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"type": "LabeledArg",
"label": {
"end": 302,
"name": "end",
"start": 299,
"type": "Identifier"
},
"arg": {
"elements": [
{
"end": 307,
"raw": "0",
"start": 306,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.0,
"suffix": "None"
}
},
{
"end": 310,
"raw": "1",
"start": 309,
"type": "Literal",
"type": "Literal",
"value": {
"value": 1.0,
"suffix": "None"
}
}
],
"end": 311,
"start": 305,
"type": "ArrayExpression",
"type": "ArrayExpression"
}
}
],
"callee": {
"end": 298,
"name": "line",
"start": 294,
"type": "Identifier"
},
"end": 312,
"start": 294,
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": null
},
{
"arguments": [
{
"type": "LabeledArg",
"label": {
"end": 332,
"name": "end",
"start": 329,
"type": "Identifier"
},
"arg": {
"elements": [
{
"end": 337,
"raw": "1",
"start": 336,
"type": "Literal",
"type": "Literal",
"value": {
"value": 1.0,
"suffix": "None"
}
},
{
"end": 340,
"raw": "0",
"start": 339,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.0,
"suffix": "None"
}
}
],
"end": 341,
"start": 335,
"type": "ArrayExpression",
"type": "ArrayExpression"
}
}
],
"callee": {
"end": 328,
"name": "line",
"start": 324,
"type": "Identifier"
},
"end": 342,
"start": 324,
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": null
},
{
"arguments": [
{
"type": "LabeledArg",
"label": {
"end": 362,
"name": "end",
"start": 359,
"type": "Identifier"
},
"arg": {
"elements": [
{
"end": 367,
"raw": "0",
"start": 366,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.0,
"suffix": "None"
}
},
{
"argument": {
"end": 371,
"raw": "1",
"start": 370,
"type": "Literal",
"type": "Literal",
"value": {
"value": 1.0,
"suffix": "None"
}
},
"end": 371,
"operator": "-",
"start": 369,
"type": "UnaryExpression",
"type": "UnaryExpression"
}
],
"end": 372,
"start": 365,
"type": "ArrayExpression",
"type": "ArrayExpression"
}
}
],
"callee": {
"end": 358,
"name": "line",
"start": 354,
"type": "Identifier"
},
"end": 373,
"start": 354,
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": null
},
{
"arguments": [
{
"end": 392,
"start": 391,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 390,
"name": "close",
"start": 385,
"type": "Identifier"
},
"end": 393,
"start": 385,
"type": "CallExpression",
"type": "CallExpression"
}
],
"end": 393,
"start": 226,
"type": "PipeExpression",
"type": "PipeExpression"
}
}
],
"start": 209,
"type": "ObjectExpression",
"type": "ObjectExpression"
}
}
],
"start": 194,
"type": "ObjectExpression",
"type": "ObjectExpression"
},
"end": 403,
"start": 187,
"type": "ReturnStatement",
"type": "ReturnStatement"
}
],
"end": 405,
"start": 183
},
"end": 405,
"params": [],
"start": 180,
"type": "FunctionExpression",
"type": "FunctionExpression"
},
"start": 175,
"type": "VariableDeclarator"
},
"end": 405,
"kind": "fn",
"start": 172,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"declaration": {
"end": 417,
"id": {
"end": 408,
"name": "x",
"start": 407,
"type": "Identifier"
},
"init": {
"arguments": [],
"callee": {
"end": 415,
"name": "test",
"start": 411,
"type": "Identifier"
},
"end": 417,
"start": 411,
"type": "CallExpression",
"type": "CallExpression"
},
"start": 407,
"type": "VariableDeclarator"
},
"end": 417,
"kind": "const",
"start": 407,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"end": 446,
"expression": {
"body": [
{
"end": 419,
"name": "x",
"start": 418,
"type": "Identifier",
"type": "Identifier"
},
{
"arguments": [
{
"type": "LabeledArg",
"label": {
"end": 439,
"name": "length",
"start": 433,
"type": "Identifier"
},
"arg": {
"argument": {
"end": 445,
"raw": "10",
"start": 443,
"type": "Literal",
"type": "Literal",
"value": {
"value": 10.0,
"suffix": "None"
}
},
"end": 445,
"operator": "-",
"start": 442,
"type": "UnaryExpression",
"type": "UnaryExpression"
}
}
],
"callee": {
"end": 432,
"name": "extrude",
"start": 425,
"type": "Identifier"
},
"end": 446,
"start": 425,
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": null
}
],
"end": 446,
"start": 418,
"type": "PipeExpression",
"type": "PipeExpression"
},
"start": 418,
"type": "ExpressionStatement",
"type": "ExpressionStatement"
},
{
"declaration": {
"end": 460,
"id": {
"end": 450,
"name": "x2",
"start": 448,
"type": "Identifier"
},
"init": {
"arguments": [],
"callee": {
"end": 458,
"name": "test2",
"start": 453,
"type": "Identifier"
},
"end": 460,
"start": 453,
"type": "CallExpression",
"type": "CallExpression"
},
"start": 448,
"type": "VariableDeclarator"
},
"end": 460,
"kind": "const",
"start": 448,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"end": 503,
"expression": {
"body": [
{
"computed": false,
"end": 477,
"object": {
"computed": false,
"end": 470,
"object": {
"end": 463,
"name": "x2",
"start": 461,
"type": "Identifier",
"type": "Identifier"
},
"property": {
"end": 470,
"name": "thing1",
"start": 464,
"type": "Identifier",
"type": "Identifier"
},
"start": 461,
"type": "MemberExpression",
"type": "MemberExpression"
},
"property": {
"end": 477,
"name": "thing2",
"start": 471,
"type": "Identifier",
"type": "Identifier"
},
"start": 461,
"type": "MemberExpression",
"type": "MemberExpression"
},
{
"arguments": [
{
"type": "LabeledArg",
"label": {
"end": 497,
"name": "length",
"start": 491,
"type": "Identifier"
},
"arg": {
"end": 502,
"raw": "10",
"start": 500,
"type": "Literal",
"type": "Literal",
"value": {
"value": 10.0,
"suffix": "None"
}
}
}
],
"callee": {
"end": 490,
"name": "extrude",
"start": 483,
"type": "Identifier"
},
"end": 503,
"start": 483,
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": null
}
],
"end": 503,
"start": 461,
"type": "PipeExpression",
"type": "PipeExpression"
},
"start": 461,
"type": "ExpressionStatement",
"type": "ExpressionStatement"
}
],
"end": 504,
"nonCodeMeta": {
"nonCodeNodes": {
"0": [
{
"end": 172,
"start": 170,
"type": "NonCodeNode",
"value": {
"type": "newLine"
}
}
],
"1": [
{
"end": 407,
"start": 405,
"type": "NonCodeNode",
"value": {
"type": "newLine"
}
}
],
"3": [
{
"end": 448,
"start": 446,
"type": "NonCodeNode",
"value": {
"type": "newLine"
}
}
]
},
"startNodes": []
},
"start": 0
}
}