astn 0.110.15 → 1.20.5

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.
Files changed (185) hide show
  1. package/.eslintignore +5 -0
  2. package/.eslintrc.js +20 -0
  3. package/.vscode/extensions.json +9 -0
  4. package/.vscode/launch.json +39 -0
  5. package/.vscode/settings.json +8 -0
  6. package/.vscode/tasks.json +33 -0
  7. package/.vscodeignore +15 -0
  8. package/LICENSE.md +204 -0
  9. package/README.md +3 -410
  10. package/backend/package-lock.json +123 -0
  11. package/backend/package.json +6 -0
  12. package/backend/src/index.ts +133 -0
  13. package/backend/tsconfig.json +16 -0
  14. package/client/package-lock.json +581 -0
  15. package/client/package.json +23 -0
  16. package/client/src/extension.ts +249 -0
  17. package/client/src/test/completion.test.ts +43 -0
  18. package/client/src/test/diagnostics.test.ts +41 -0
  19. package/client/src/test/helper.ts +47 -0
  20. package/client/src/test/index.ts +43 -0
  21. package/client/src/test/runTest.ts +27 -0
  22. package/client/testFixture/diagnostics.txt +1 -0
  23. package/client/tsconfig.json +12 -0
  24. package/client/tsconfig.tsbuildinfo +1 -0
  25. package/development.md +12 -0
  26. package/images/icon.png +0 -0
  27. package/language-configuration.json +36 -0
  28. package/package.json +102 -58
  29. package/scripts/e2e.sh +6 -0
  30. package/server/package-lock.json +127 -0
  31. package/server/package.json +22 -0
  32. package/server/src/backend.ts +53 -0
  33. package/server/src/backendapi.ts +66 -0
  34. package/server/src/server.ts +296 -0
  35. package/server/tsconfig.json +14 -0
  36. package/server/tsconfig.tsbuildinfo +1 -0
  37. package/syntaxes/astn.tmLanguage.json +320 -0
  38. package/tsconfig.json +21 -0
  39. package/LICENSE +0 -17
  40. package/dist/bin/convert_to_json.d.ts +0 -2
  41. package/dist/bin/convert_to_json.js +0 -63
  42. package/dist/bin/validate_astn.d.ts +0 -2
  43. package/dist/bin/validate_astn.js +0 -58
  44. package/dist/generated/generic/resolve.d.ts +0 -90
  45. package/dist/generated/generic/resolve.js +0 -259
  46. package/dist/generated/implementation/schemas/ast/migration_boilerplate.d.ts +0 -13
  47. package/dist/generated/implementation/schemas/ast/migration_boilerplate.js +0 -174
  48. package/dist/generated/implementation/schemas/ide/migration_boilerplate.d.ts +0 -2
  49. package/dist/generated/implementation/schemas/ide/migration_boilerplate.js +0 -56
  50. package/dist/generated/implementation/schemas/parse_result/migration_boilerplate.d.ts +0 -6
  51. package/dist/generated/implementation/schemas/parse_result/migration_boilerplate.js +0 -136
  52. package/dist/generated/implementation/schemas/target/migration_boilerplate.d.ts +0 -3
  53. package/dist/generated/implementation/schemas/target/migration_boilerplate.js +0 -73
  54. package/dist/generated/implementation/schemas/target_json/migration_boilerplate.d.ts +0 -3
  55. package/dist/generated/implementation/schemas/target_json/migration_boilerplate.js +0 -67
  56. package/dist/generated/interface/core/poormans_parser.d.ts +0 -184
  57. package/dist/generated/interface/core/poormans_parser.js +0 -3
  58. package/dist/generated/interface/core/resolved.d.ts +0 -100
  59. package/dist/generated/interface/core/resolved.js +0 -3
  60. package/dist/generated/interface/core/unresolved.d.ts +0 -35
  61. package/dist/generated/interface/core/unresolved.js +0 -3
  62. package/dist/generated/interface/schemas/ast/migration_boilerplate.d.ts +0 -266
  63. package/dist/generated/interface/schemas/ast/migration_boilerplate.js +0 -3
  64. package/dist/generated/interface/schemas/ast/poormans_parser.d.ts +0 -1087
  65. package/dist/generated/interface/schemas/ast/poormans_parser.js +0 -3
  66. package/dist/generated/interface/schemas/ast/resolved.d.ts +0 -1087
  67. package/dist/generated/interface/schemas/ast/resolved.js +0 -3
  68. package/dist/generated/interface/schemas/ast/unresolved.d.ts +0 -1087
  69. package/dist/generated/interface/schemas/ast/unresolved.js +0 -3
  70. package/dist/generated/interface/schemas/ide/migration_boilerplate.d.ts +0 -24
  71. package/dist/generated/interface/schemas/ide/migration_boilerplate.js +0 -3
  72. package/dist/generated/interface/schemas/ide/poormans_parser.d.ts +0 -161
  73. package/dist/generated/interface/schemas/ide/poormans_parser.js +0 -3
  74. package/dist/generated/interface/schemas/ide/resolved.d.ts +0 -161
  75. package/dist/generated/interface/schemas/ide/resolved.js +0 -3
  76. package/dist/generated/interface/schemas/ide/unresolved.d.ts +0 -161
  77. package/dist/generated/interface/schemas/ide/unresolved.js +0 -3
  78. package/dist/generated/interface/schemas/parse_result/migration_boilerplate.d.ts +0 -112
  79. package/dist/generated/interface/schemas/parse_result/migration_boilerplate.js +0 -3
  80. package/dist/generated/interface/schemas/parse_result/poormans_parser.d.ts +0 -416
  81. package/dist/generated/interface/schemas/parse_result/poormans_parser.js +0 -3
  82. package/dist/generated/interface/schemas/parse_result/resolved.d.ts +0 -416
  83. package/dist/generated/interface/schemas/parse_result/resolved.js +0 -3
  84. package/dist/generated/interface/schemas/parse_result/unresolved.d.ts +0 -416
  85. package/dist/generated/interface/schemas/parse_result/unresolved.js +0 -3
  86. package/dist/generated/interface/schemas/target/migration_boilerplate.d.ts +0 -46
  87. package/dist/generated/interface/schemas/target/migration_boilerplate.js +0 -3
  88. package/dist/generated/interface/schemas/target/poormans_parser.d.ts +0 -186
  89. package/dist/generated/interface/schemas/target/poormans_parser.js +0 -3
  90. package/dist/generated/interface/schemas/target/resolved.d.ts +0 -186
  91. package/dist/generated/interface/schemas/target/resolved.js +0 -3
  92. package/dist/generated/interface/schemas/target/unresolved.d.ts +0 -186
  93. package/dist/generated/interface/schemas/target/unresolved.js +0 -3
  94. package/dist/generated/interface/schemas/target_json/migration_boilerplate.d.ts +0 -46
  95. package/dist/generated/interface/schemas/target_json/migration_boilerplate.js +0 -3
  96. package/dist/generated/interface/schemas/target_json/poormans_parser.d.ts +0 -169
  97. package/dist/generated/interface/schemas/target_json/poormans_parser.js +0 -3
  98. package/dist/generated/interface/schemas/target_json/resolved.d.ts +0 -169
  99. package/dist/generated/interface/schemas/target_json/resolved.js +0 -3
  100. package/dist/generated/interface/schemas/target_json/unresolved.d.ts +0 -169
  101. package/dist/generated/interface/schemas/target_json/unresolved.js +0 -3
  102. package/dist/globals.d.ts +0 -24
  103. package/dist/globals.js +0 -2
  104. package/dist/index.d.ts +0 -6
  105. package/dist/index.js +0 -43
  106. package/dist/lib/globals.d.ts +0 -24
  107. package/dist/lib/globals.js +0 -2
  108. package/dist/lib/transformations/create_error_message.d.ts +0 -5
  109. package/dist/lib/transformations/create_error_message.js +0 -89
  110. package/dist/lib/transformations/format.d.ts +0 -42
  111. package/dist/lib/transformations/format.js +0 -166
  112. package/dist/lib/transformations/fountain_pen/astn.d.ts +0 -11
  113. package/dist/lib/transformations/fountain_pen/astn.js +0 -156
  114. package/dist/lib/transformations/fountain_pen/json.d.ts +0 -4
  115. package/dist/lib/transformations/fountain_pen/json.js +0 -113
  116. package/dist/lib/transformations/parse.d.ts +0 -11
  117. package/dist/lib/transformations/parse.js +0 -257
  118. package/dist/lib/transformations/parse_generic.d.ts +0 -43
  119. package/dist/lib/transformations/parse_generic.js +0 -644
  120. package/dist/parse/parse.d.ts +0 -11
  121. package/dist/parse/parse.js +0 -267
  122. package/dist/parse/parse_generic.d.ts +0 -43
  123. package/dist/parse/parse_generic.js +0 -656
  124. package/dist/serializers/astn.js +0 -28
  125. package/dist/serializers/json.d.ts +0 -5
  126. package/dist/serializers/json.js +0 -46
  127. package/dist/serializers/parse_result.d.ts +0 -5
  128. package/dist/serializers/parse_result.js +0 -99
  129. package/dist/transformations/ast/ide.d.ts +0 -42
  130. package/dist/transformations/ast/ide.js +0 -176
  131. package/dist/transformations/ast/json_target.d.ts +0 -6
  132. package/dist/transformations/ast/json_target.js +0 -88
  133. package/dist/transformations/create_error_message.d.ts +0 -5
  134. package/dist/transformations/create_error_message.js +0 -89
  135. package/dist/transformations/format.d.ts +0 -42
  136. package/dist/transformations/format.js +0 -166
  137. package/dist/transformations/fountain_pen/astn.d.ts +0 -11
  138. package/dist/transformations/fountain_pen/astn.js +0 -166
  139. package/dist/transformations/fountain_pen/json.d.ts +0 -4
  140. package/dist/transformations/fountain_pen/json.js +0 -123
  141. package/dist/transformations/parse.d.ts +0 -11
  142. package/dist/transformations/parse.js +0 -257
  143. package/dist/transformations/parse_generic.d.ts +0 -43
  144. package/dist/transformations/parse_generic.js +0 -644
  145. package/dist/transformations/target/fountain_pen/astn.d.ts +0 -11
  146. package/dist/transformations/target/fountain_pen/astn.js +0 -156
  147. package/dist/transformations/target/fountain_pen/json.d.ts +0 -4
  148. package/dist/transformations/target/fountain_pen/json.js +0 -113
  149. package/dist/transformations/target/fountain_pen_block.d.ts +0 -11
  150. package/dist/transformations/target/fountain_pen_block.js +0 -166
  151. package/dist/transformations/target_json/fountain_pen_block.d.ts +0 -4
  152. package/dist/transformations/target_json/fountain_pen_block.js +0 -101
  153. package/documentation/railroad_diagram/diagram/apostrophed_string.png +0 -0
  154. package/documentation/railroad_diagram/diagram/astn_document.png +0 -0
  155. package/documentation/railroad_diagram/diagram/backticked_string.png +0 -0
  156. package/documentation/railroad_diagram/diagram/comment.png +0 -0
  157. package/documentation/railroad_diagram/diagram/concise_group.png +0 -0
  158. package/documentation/railroad_diagram/diagram/content.png +0 -0
  159. package/documentation/railroad_diagram/diagram/dictionary.png +0 -0
  160. package/documentation/railroad_diagram/diagram/elements.png +0 -0
  161. package/documentation/railroad_diagram/diagram/escaped_character.png +0 -0
  162. package/documentation/railroad_diagram/diagram/four_hexadecimal_digits.png +0 -0
  163. package/documentation/railroad_diagram/diagram/header.png +0 -0
  164. package/documentation/railroad_diagram/diagram/hexadecimal_digit.png +0 -0
  165. package/documentation/railroad_diagram/diagram/ignorable.png +0 -0
  166. package/documentation/railroad_diagram/diagram/include.png +0 -0
  167. package/documentation/railroad_diagram/diagram/key_value_pairs.png +0 -0
  168. package/documentation/railroad_diagram/diagram/line_comment.png +0 -0
  169. package/documentation/railroad_diagram/diagram/list.png +0 -0
  170. package/documentation/railroad_diagram/diagram/newline_character.png +0 -0
  171. package/documentation/railroad_diagram/diagram/normal_character.png +0 -0
  172. package/documentation/railroad_diagram/diagram/normal_or_newline_character.png +0 -0
  173. package/documentation/railroad_diagram/diagram/quoted_string.png +0 -0
  174. package/documentation/railroad_diagram/diagram/rr-2.5.png +0 -0
  175. package/documentation/railroad_diagram/diagram/set_optional_value.png +0 -0
  176. package/documentation/railroad_diagram/diagram/string.png +0 -0
  177. package/documentation/railroad_diagram/diagram/string_content_character.png +0 -0
  178. package/documentation/railroad_diagram/diagram/tagged_value.png +0 -0
  179. package/documentation/railroad_diagram/diagram/traditional_comment.png +0 -0
  180. package/documentation/railroad_diagram/diagram/undelimited_string.png +0 -0
  181. package/documentation/railroad_diagram/diagram/value.png +0 -0
  182. package/documentation/railroad_diagram/diagram/verbose_group.png +0 -0
  183. package/documentation/railroad_diagram/diagram/whitespace.png +0 -0
  184. package/documentation/railroad_diagram/index.md +0 -425
  185. /package/{dist/serializers/astn.d.ts → client/testFixture/completion.txt} +0 -0
package/package.json CHANGED
@@ -1,60 +1,104 @@
1
1
  {
2
- "name": "astn",
3
- "version": "0.110.15",
4
- "description": "A TypeScript library for parsing and formatting ASTN (Abstract Syntax Tree Notation) - a human-editable data format for structured content",
5
- "main": "./dist/index.js",
6
- "types": "dist/index.d.ts",
7
- "module": "./dist/index.js",
8
- "bin": {
9
- "astn-validate": "./dist/bin/validate_astn.js"
10
- },
11
- "files": [
12
- "dist",
13
- "README.md",
14
- "LICENSE",
15
- "documentation"
16
- ],
17
- "scripts": {
18
- "build": "tsc",
19
- "clean": "rm -rf dist",
20
- "prepare": "npm run build",
21
- "test": "echo \"Error: no test specified\" && exit 1",
22
- "validate": "node dist/bin/validate_astn.js"
23
- },
24
- "keywords": [
25
- "astn",
26
- "parser",
27
- "formatter",
28
- "abstract-syntax-tree",
29
- "data-format",
30
- "typescript",
31
- "lexer",
32
- "structured-data",
33
- "configuration",
34
- "serialization"
35
- ],
36
- "author": "Corno",
37
- "license": "Apache-2.0",
38
- "repository": {
39
- "type": "git",
40
- "url": "https://github.com/corno/astn.git"
41
- },
42
- "bugs": {
43
- "url": "https://github.com/corno/astn/issues"
44
- },
45
- "homepage": "https://github.com/corno/astn#readme",
46
- "engines": {
47
- "node": ">=14.0.0"
48
- },
49
- "dependencies": {
50
- "exupery-core-alg": "^0.1.4",
51
- "exupery-core-data": "^0.1.0",
52
- "exupery-core-dev": "^0.1.1",
53
- "exupery-core-resources": "^0.2.1",
54
- "pareto-fountain-pen": "^0.1.3",
55
- "pareto-standard-operations": "^0.1.0"
56
- },
57
- "devDependencies": {
58
- "typescript": "^5.0.0"
59
- }
2
+ "name": "astn",
3
+ "description": "ASTN Language (Abstract Syntax Tree Notation) support; syntax highlighting, formatting, validation, conversion to and from JSON.",
4
+ "author": "Corno",
5
+ "license": "Apache-2.0",
6
+ "version": "1.20.5",
7
+ "icon": "images/icon.png",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "https://github.com/corno/astn-vscode"
11
+ },
12
+ "publisher": "corno",
13
+ "categories": [],
14
+ "keywords": [
15
+ "ASTN",
16
+ "syntax highlighting",
17
+ "formatting",
18
+ "validation",
19
+ "JSON",
20
+ "conversion"
21
+ ],
22
+ "engines": {
23
+ "vscode": "^1.75.0"
24
+ },
25
+ "activationEvents": [],
26
+ "main": "./client/out/extension",
27
+ "contributes": {
28
+ "languages": [
29
+ {
30
+ "id": "astn",
31
+ "aliases": [
32
+ "astn"
33
+ ],
34
+ "extensions": [
35
+ ".astn",
36
+ ".astn-schema"
37
+ ],
38
+ "configuration": "./language-configuration.json"
39
+ }
40
+ ],
41
+ "grammars": [
42
+ {
43
+ "language": "astn",
44
+ "scopeName": "source.astn",
45
+ "path": "./syntaxes/astn.tmLanguage.json"
46
+ }
47
+ ],
48
+ "configuration": {
49
+ "type": "object",
50
+ "title": "ASTN configuration",
51
+ "properties": {}
52
+ },
53
+ "commands": [
54
+ {
55
+ "command": "astn.convert_to_json",
56
+ "title": "ASTN: convert to JSON"
57
+ },
58
+ {
59
+ "command": "astn.sort_alphabetically",
60
+ "title": "ASTN: sort collection alphabetically"
61
+ },
62
+ {
63
+ "command": "astn.save_as_json",
64
+ "title": "ASTN: save as JSON file"
65
+ }
66
+ ],
67
+ "menus": {
68
+ "editor/context": [
69
+ {
70
+ "command": "astn.convert_to_json",
71
+ "when": "editorLangId == astn",
72
+ "group": "1_astn"
73
+ },
74
+ {
75
+ "command": "astn.sort_alphabetically",
76
+ "when": "editorLangId == astn",
77
+ "group": "1_astn"
78
+ },
79
+ {
80
+ "command": "astn.save_as_json",
81
+ "when": "editorLangId == astn",
82
+ "group": "1_astn"
83
+ }
84
+ ]
85
+ }
86
+ },
87
+ "scripts": {
88
+ "vscode:prepublish": "npm run compile",
89
+ "compile": "tsc -b",
90
+ "watch": "tsc -b -w",
91
+ "lint": "eslint ./client/src ./server/src --ext .ts,.tsx",
92
+ "postinstall": "cd client && npm install && cd ../server && npm install && cd ..",
93
+ "test": "sh ./scripts/e2e.sh"
94
+ },
95
+ "devDependencies": {
96
+ "@types/mocha": "^10.0.6",
97
+ "@types/node": "^18.14.6",
98
+ "@typescript-eslint/eslint-plugin": "^7.1.0",
99
+ "@typescript-eslint/parser": "^7.1.0",
100
+ "eslint": "^8.57.0",
101
+ "mocha": "^10.3.0",
102
+ "typescript": "^5.3.3"
103
+ }
60
104
  }
package/scripts/e2e.sh ADDED
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env bash
2
+
3
+ export CODE_TESTS_PATH="$(pwd)/client/out/test"
4
+ export CODE_TESTS_WORKSPACE="$(pwd)/client/testFixture"
5
+
6
+ node "$(pwd)/client/out/test/runTest"
@@ -0,0 +1,127 @@
1
+ {
2
+ "name": "lsp-sample-server",
3
+ "version": "1.0.0",
4
+ "lockfileVersion": 2,
5
+ "requires": true,
6
+ "packages": {
7
+ "": {
8
+ "name": "lsp-sample-server",
9
+ "version": "1.0.0",
10
+ "license": "MIT",
11
+ "dependencies": {
12
+ "vscode-languageserver": "^9.0.1",
13
+ "vscode-languageserver-textdocument": "^1.0.11"
14
+ },
15
+ "devDependencies": {
16
+ "@types/node": "^24.0.15"
17
+ },
18
+ "engines": {
19
+ "node": "*"
20
+ }
21
+ },
22
+ "node_modules/@types/node": {
23
+ "version": "24.0.15",
24
+ "resolved": "https://registry.npmjs.org/@types/node/-/node-24.0.15.tgz",
25
+ "integrity": "sha512-oaeTSbCef7U/z7rDeJA138xpG3NuKc64/rZ2qmUFkFJmnMsAPaluIifqyWd8hSSMxyP9oie3dLAqYPblag9KgA==",
26
+ "dev": true,
27
+ "license": "MIT",
28
+ "dependencies": {
29
+ "undici-types": "~7.8.0"
30
+ }
31
+ },
32
+ "node_modules/undici-types": {
33
+ "version": "7.8.0",
34
+ "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.8.0.tgz",
35
+ "integrity": "sha512-9UJ2xGDvQ43tYyVMpuHlsgApydB8ZKfVYTsLDhXkFL/6gfkp+U8xTGdh8pMJv1SpZna0zxG1DwsKZsreLbXBxw==",
36
+ "dev": true,
37
+ "license": "MIT"
38
+ },
39
+ "node_modules/vscode-jsonrpc": {
40
+ "version": "8.2.0",
41
+ "resolved": "https://registry.npmjs.org/vscode-jsonrpc/-/vscode-jsonrpc-8.2.0.tgz",
42
+ "integrity": "sha512-C+r0eKJUIfiDIfwJhria30+TYWPtuHJXHtI7J0YlOmKAo7ogxP20T0zxB7HZQIFhIyvoBPwWskjxrvAtfjyZfA==",
43
+ "engines": {
44
+ "node": ">=14.0.0"
45
+ }
46
+ },
47
+ "node_modules/vscode-languageserver": {
48
+ "version": "9.0.1",
49
+ "resolved": "https://registry.npmjs.org/vscode-languageserver/-/vscode-languageserver-9.0.1.tgz",
50
+ "integrity": "sha512-woByF3PDpkHFUreUa7Hos7+pUWdeWMXRd26+ZX2A8cFx6v/JPTtd4/uN0/jB6XQHYaOlHbio03NTHCqrgG5n7g==",
51
+ "dependencies": {
52
+ "vscode-languageserver-protocol": "3.17.5"
53
+ },
54
+ "bin": {
55
+ "installServerIntoExtension": "bin/installServerIntoExtension"
56
+ }
57
+ },
58
+ "node_modules/vscode-languageserver-protocol": {
59
+ "version": "3.17.5",
60
+ "resolved": "https://registry.npmjs.org/vscode-languageserver-protocol/-/vscode-languageserver-protocol-3.17.5.tgz",
61
+ "integrity": "sha512-mb1bvRJN8SVznADSGWM9u/b07H7Ecg0I3OgXDuLdn307rl/J3A9YD6/eYOssqhecL27hK1IPZAsaqh00i/Jljg==",
62
+ "dependencies": {
63
+ "vscode-jsonrpc": "8.2.0",
64
+ "vscode-languageserver-types": "3.17.5"
65
+ }
66
+ },
67
+ "node_modules/vscode-languageserver-textdocument": {
68
+ "version": "1.0.11",
69
+ "resolved": "https://registry.npmjs.org/vscode-languageserver-textdocument/-/vscode-languageserver-textdocument-1.0.11.tgz",
70
+ "integrity": "sha512-X+8T3GoiwTVlJbicx/sIAF+yuJAqz8VvwJyoMVhwEMoEKE/fkDmrqUgDMyBECcM2A2frVZIUj5HI/ErRXCfOeA=="
71
+ },
72
+ "node_modules/vscode-languageserver-types": {
73
+ "version": "3.17.5",
74
+ "resolved": "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-3.17.5.tgz",
75
+ "integrity": "sha512-Ld1VelNuX9pdF39h2Hgaeb5hEZM2Z3jUrrMgWQAu82jMtZp7p3vJT3BzToKtZI7NgQssZje5o0zryOrhQvzQAg=="
76
+ }
77
+ },
78
+ "dependencies": {
79
+ "@types/node": {
80
+ "version": "24.0.15",
81
+ "resolved": "https://registry.npmjs.org/@types/node/-/node-24.0.15.tgz",
82
+ "integrity": "sha512-oaeTSbCef7U/z7rDeJA138xpG3NuKc64/rZ2qmUFkFJmnMsAPaluIifqyWd8hSSMxyP9oie3dLAqYPblag9KgA==",
83
+ "dev": true,
84
+ "requires": {
85
+ "undici-types": "~7.8.0"
86
+ }
87
+ },
88
+ "undici-types": {
89
+ "version": "7.8.0",
90
+ "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.8.0.tgz",
91
+ "integrity": "sha512-9UJ2xGDvQ43tYyVMpuHlsgApydB8ZKfVYTsLDhXkFL/6gfkp+U8xTGdh8pMJv1SpZna0zxG1DwsKZsreLbXBxw==",
92
+ "dev": true
93
+ },
94
+ "vscode-jsonrpc": {
95
+ "version": "8.2.0",
96
+ "resolved": "https://registry.npmjs.org/vscode-jsonrpc/-/vscode-jsonrpc-8.2.0.tgz",
97
+ "integrity": "sha512-C+r0eKJUIfiDIfwJhria30+TYWPtuHJXHtI7J0YlOmKAo7ogxP20T0zxB7HZQIFhIyvoBPwWskjxrvAtfjyZfA=="
98
+ },
99
+ "vscode-languageserver": {
100
+ "version": "9.0.1",
101
+ "resolved": "https://registry.npmjs.org/vscode-languageserver/-/vscode-languageserver-9.0.1.tgz",
102
+ "integrity": "sha512-woByF3PDpkHFUreUa7Hos7+pUWdeWMXRd26+ZX2A8cFx6v/JPTtd4/uN0/jB6XQHYaOlHbio03NTHCqrgG5n7g==",
103
+ "requires": {
104
+ "vscode-languageserver-protocol": "3.17.5"
105
+ }
106
+ },
107
+ "vscode-languageserver-protocol": {
108
+ "version": "3.17.5",
109
+ "resolved": "https://registry.npmjs.org/vscode-languageserver-protocol/-/vscode-languageserver-protocol-3.17.5.tgz",
110
+ "integrity": "sha512-mb1bvRJN8SVznADSGWM9u/b07H7Ecg0I3OgXDuLdn307rl/J3A9YD6/eYOssqhecL27hK1IPZAsaqh00i/Jljg==",
111
+ "requires": {
112
+ "vscode-jsonrpc": "8.2.0",
113
+ "vscode-languageserver-types": "3.17.5"
114
+ }
115
+ },
116
+ "vscode-languageserver-textdocument": {
117
+ "version": "1.0.11",
118
+ "resolved": "https://registry.npmjs.org/vscode-languageserver-textdocument/-/vscode-languageserver-textdocument-1.0.11.tgz",
119
+ "integrity": "sha512-X+8T3GoiwTVlJbicx/sIAF+yuJAqz8VvwJyoMVhwEMoEKE/fkDmrqUgDMyBECcM2A2frVZIUj5HI/ErRXCfOeA=="
120
+ },
121
+ "vscode-languageserver-types": {
122
+ "version": "3.17.5",
123
+ "resolved": "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-3.17.5.tgz",
124
+ "integrity": "sha512-Ld1VelNuX9pdF39h2Hgaeb5hEZM2Z3jUrrMgWQAu82jMtZp7p3vJT3BzToKtZI7NgQssZje5o0zryOrhQvzQAg=="
125
+ }
126
+ }
127
+ }
@@ -0,0 +1,22 @@
1
+ {
2
+ "name": "lsp-sample-server",
3
+ "description": "Example implementation of a language server in node.",
4
+ "version": "1.0.0",
5
+ "author": "Microsoft Corporation",
6
+ "license": "MIT",
7
+ "engines": {
8
+ "node": "*"
9
+ },
10
+ "repository": {
11
+ "type": "git",
12
+ "url": "https://github.com/Microsoft/vscode-extension-samples"
13
+ },
14
+ "dependencies": {
15
+ "vscode-languageserver": "^9.0.1",
16
+ "vscode-languageserver-textdocument": "^1.0.11"
17
+ },
18
+ "scripts": {},
19
+ "devDependencies": {
20
+ "@types/node": "^24.0.15"
21
+ }
22
+ }
@@ -0,0 +1,53 @@
1
+ import * as api from "./backendapi"
2
+
3
+ import * as backend from "../../backend/dist"
4
+
5
+ export const $: api.Backend = {
6
+ 'completion': {
7
+ 'getTriggerCharacters': () => null,
8
+ 'onCompletion': (
9
+ $,
10
+ cb
11
+ ) => {
12
+ cb({
13
+ 'completionItems': [
14
+ {
15
+ 'label': "Textpad",
16
+ },
17
+ {
18
+ 'label': "Javascript",
19
+ },
20
+ {
21
+ 'label': "Foobar",
22
+ },
23
+ ]
24
+ })
25
+ },
26
+ },
27
+ 'onHover': (
28
+ $,
29
+ cb
30
+ ) => {
31
+ cb({
32
+ 'hovertexts': ["ABCDEF", "XXXX"]
33
+ })
34
+ },
35
+ 'validateTextDocument': (
36
+ $,
37
+ $p,
38
+ cb
39
+ ) => {
40
+ const diagnostics = backend.validate_text_document(
41
+ $.content,
42
+ {
43
+ 'options': {
44
+ 'tab size': $p['tab size'],
45
+ }
46
+ }
47
+ )
48
+
49
+ // Send the computed diagnostics to VSCode.
50
+ cb({ diagnostics: diagnostics.__get_raw_copy() });
51
+ }
52
+
53
+ }
@@ -0,0 +1,66 @@
1
+ /**
2
+ * This file is intended to not have any vscode imports
3
+ */
4
+
5
+ import * as backend from "../../backend/dist"
6
+
7
+ export type DiagnosticSeverity =
8
+ | ["error", null]
9
+ | ["warning", null]
10
+ | ["information", null]
11
+ | ["hint", null]
12
+
13
+
14
+ export type Diagnostic = backend.Diagnostic
15
+
16
+ export type DocumentData = {
17
+
18
+ uri: string
19
+ content: string
20
+ }
21
+
22
+ export type ValidateTextDocument = (
23
+ $: DocumentData,
24
+ $p: {
25
+ 'tab size': number,
26
+ },
27
+ cb: ($: {
28
+ diagnostics: readonly Diagnostic[]
29
+ }) => void
30
+ ) => void
31
+
32
+
33
+ export type OnHover = (
34
+ $: {
35
+ document: DocumentData
36
+ offset: number
37
+ },
38
+ cb: ($: {
39
+ hovertexts: string[]
40
+ }) => void
41
+ ) => void
42
+
43
+
44
+
45
+ export type GetCompletionTriggerCharacters = () => null | string[]
46
+
47
+ export type OnCompletion = (
48
+ $: {
49
+ document: DocumentData
50
+ offset: number
51
+ },
52
+ cb: ($: {
53
+ completionItems: {
54
+ label: string
55
+ }[]
56
+ }) => void
57
+ ) => void
58
+
59
+ export type Backend = {
60
+ 'validateTextDocument': ValidateTextDocument
61
+ 'completion': {
62
+ 'getTriggerCharacters': GetCompletionTriggerCharacters
63
+ 'onCompletion': OnCompletion
64
+ }
65
+ 'onHover': OnHover
66
+ }