caos-language-server 0.1.4 → 0.1.6
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/README.md +23 -100
- package/dist/node/server.cjs +493 -476
- package/dist/web/server.cjs +487 -470
- package/package.json +11 -9
package/README.md
CHANGED
|
@@ -1,114 +1,37 @@
|
|
|
1
|
-
#
|
|
1
|
+
# caos-language-server
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
*\*Workspaces are scoped to a specific CAOS variant*
|
|
3
|
+
Language Server Protocol implementation for the Creatures CAOS language and catalogue files. It provides diagnostics, completions, hover documentation, formatting, semantic tokens, inlay hints, symbols, definitions, references, and rename support.
|
|
5
4
|
|
|
6
|
-
##
|
|
7
|
-
- CAOS syntax error highlighting
|
|
8
|
-
- Invalid command
|
|
9
|
-
- Unclosed control blocks (i.e. `DOIF`, `ENUM`)
|
|
10
|
-
- Out of variant commands and variables
|
|
11
|
-
- Missing parameters
|
|
12
|
-
- Very basic type checking
|
|
13
|
-
- Semantic tokens for use in custom highlighting
|
|
14
|
-
- Code completion
|
|
15
|
-
- Commands scoped to type (i.e. Command, R/L value)
|
|
16
|
-
- Subroutine Name
|
|
17
|
-
- Simple game/name variable name completions (does not scope or restrict `NAME` variables to agent class)
|
|
18
|
-
- Named value completion (i.e. type `hung`, select 'Hunger for Protein' and completion inserts corresponding numeric value)
|
|
19
|
-
- Hover documentation
|
|
20
|
-
- Inlay Hints (can be disabled)
|
|
21
|
-
- Known value names (i.e. Show drive name for corresponding numeric value)
|
|
22
|
-
- Bitflag breakdown (i.e. Append inlay hint `(activatable, mousable)` after `attr 3`)
|
|
23
|
-
- Parameter names (minimum number of parameters before showing hint is configurable)
|
|
24
|
-
- Command return values
|
|
25
|
-
- Basic code formatting
|
|
5
|
+
## Install
|
|
26
6
|
|
|
27
|
-
|
|
28
|
-
|
|
7
|
+
```sh
|
|
8
|
+
npm install caos-language-server
|
|
9
|
+
```
|
|
29
10
|
|
|
30
|
-
|
|
31
|
-
* `caosScript.maxNumberOfProblems`: Set maximum number of errors to report
|
|
32
|
-
* `caosScript.variant`: Workspace CAOS variant. Can be **[C1,C2,CV,C3,DS]**. Default **DS**
|
|
33
|
-
* `caosScript.formatting.indentComments`: Indent comments inline with commands except when comment is at start of line
|
|
34
|
-
* ### Inlay Hints
|
|
35
|
-
* `caosScript.inlayHints.bitFlagValues`: Show inlay hints for bitflag value
|
|
36
|
-
* `caosScript.inlayHints.parameterHints.showParameterHints`: Show parameter names before arguments
|
|
37
|
-
* `caosScript.inlayHints.parameterHints.minimumParameterCount`: Hide inlay hints for commands with less than this number of parameters
|
|
38
|
-
* `caosScript.inlayHints.setvParameterHints`: Show parameter names before SETV like command arguments
|
|
39
|
-
* `caosScript.inlayHints.genusName`: Show genus name for known family/genus combinations
|
|
40
|
-
* `caosScript.inlayHints.valueName`: Show value name for known integer and string values
|
|
41
|
-
* `caosScript.inlayHints.eventScriptName`: Show event script name for known event numbers
|
|
42
|
-
* `caosScript.inlayHints.ddePictDimensions`: Show `DDE: PICT` command dimensions from dimension characters
|
|
43
|
-
* `caosScript.inlayHints.c1ClasValue`: Show parsed family, genus, and specie from C1 CLAS value
|
|
44
|
-
* `caosScript.inlayHints.rvalueReturnValue`: Show return type for rvalue commands
|
|
45
|
-
* `caosScript.inlayHints.equality.bitFlagValues`: Show Bitflag value on opposing side of equality operator
|
|
46
|
-
* `caosScript.inlayHints.equalityValueName`: Show value name for know integer and string values on opposing side of EQ
|
|
11
|
+
## Use with an editor client
|
|
47
12
|
|
|
48
|
-
|
|
49
|
-
Some CAOS file elements have additional semantic token selectors on them which allows
|
|
50
|
-
for more specific styling
|
|
51
|
-
### Main Tokens
|
|
52
|
-
* `command`: root level command name tokens
|
|
53
|
-
* `rvalue`: rvalue command name tokens
|
|
54
|
-
* `lvalue`: command tokens when command is used as lvalue
|
|
55
|
-
### Token Modifiers
|
|
56
|
-
* `command-prefix`: First token in a multi-word command
|
|
57
|
-
* `command-suffix`: Last token in a three word command
|
|
58
|
-
* `c1-string`: A C1 style bracket string
|
|
59
|
-
* `quote-string`: A C2e style quoted string
|
|
60
|
-
* `byte-string`: A byte string for things like ANIM
|
|
61
|
-
* `not-found`: For a command that cannot be found in context
|
|
62
|
-
* `vaxx`: for VAxx and VARx variables
|
|
63
|
-
* `ovxx`: for OVxx and OBVx variables
|
|
64
|
-
* `mvxx`: For MVxx variables
|
|
65
|
-
* `returns-number`: Decorates command words for commands that return a number
|
|
66
|
-
* `returns-string`: Decorates command words for commands returning a string
|
|
67
|
-
* `returns-variable`: Decorates command word for commands returning a variable
|
|
68
|
-
* `returns-agent`: Decorates command word for commands returning an agent
|
|
69
|
-
* `agent-constructor`: Decorates agent constructor commands like those starting with `new:`
|
|
13
|
+
The package exposes a `caos-language-server` executable and a Node/browser server bundle. It is designed to be launched by an LSP-compatible client, such as the accompanying `caos-vscode-client` package.
|
|
70
14
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
```JSON
|
|
74
|
-
{
|
|
75
|
-
"editor.semanticTokenColorCustomizations": {
|
|
76
|
-
"[Default Dark+]": {
|
|
77
|
-
"*.returns-string:caos": "#ff0011"
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
}
|
|
15
|
+
```sh
|
|
16
|
+
npx caos-language-server
|
|
81
17
|
```
|
|
82
18
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
- Occasionally completion becomes confused.
|
|
86
|
-
- Suggests commands instead of R/L values unexpectedly
|
|
87
|
-
- Suggests known values for values already completed previously
|
|
88
|
-
- Fails to show suggestions for named values
|
|
89
|
-
- Navigation fails from `SUBR` names to their usages
|
|
90
|
-
|
|
91
|
-
## Release Notes
|
|
19
|
+
The Node server uses the transport configured by `vscode-languageserver` for its host integration. Editor clients should launch the executable through their LSP client library instead of treating it as a command-line tool with a human-readable interface.
|
|
92
20
|
|
|
93
|
-
|
|
21
|
+
## Configuration
|
|
94
22
|
|
|
95
|
-
|
|
23
|
+
Clients may provide CAOS settings through the LSP configuration mechanism. The primary setting is:
|
|
96
24
|
|
|
97
|
-
|
|
25
|
+
```json
|
|
26
|
+
{
|
|
27
|
+
"caosScript": {
|
|
28
|
+
"variant": "DS"
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
```
|
|
98
32
|
|
|
99
|
-
|
|
100
|
-
* subroutine (`SUBR`) names
|
|
101
|
-
* `GAME`/`EAME`/`NAME` variable names
|
|
102
|
-
* **CAOS2Pray**
|
|
103
|
-
* Completions
|
|
104
|
-
* File name
|
|
105
|
-
* Known tags
|
|
106
|
-
* Commands
|
|
107
|
-
* Highlighting
|
|
108
|
-
* Compilation
|
|
109
|
-
* **PRAY file support**
|
|
110
|
-
* Completions
|
|
111
|
-
* Error checking
|
|
33
|
+
Supported variants are `C1`, `C2`, `CV`, `C3`, `DS`, and `DS:CE`.
|
|
112
34
|
|
|
113
35
|
## License
|
|
114
|
-
|
|
36
|
+
|
|
37
|
+
MIT
|