caos-language-server
v0.1.3
Published
A language server for Creature's CAOS language
Downloads
4
Readme
CAOS Language Server
This language server implements the Language Server protocol for handling CAOS language files
*Workspaces are scoped to a specific CAOS variant
Features
- CAOS syntax error highlighting
- Invalid command
- Unclosed control blocks (i.e.
DOIF
,ENUM
) - Out of variant commands and variables
- Missing parameters
- Very basic type checking
- Semantic tokens for use in custom highlighting
- Code completion
- Commands scoped to type (i.e. Command, R/L value)
- Subroutine Name
- Simple game/name variable name completions (does not scope or restrict
NAME
variables to agent class) - Named value completion (i.e. type
hung
, select 'Hunger for Protein' and completion inserts corresponding numeric value)
- Hover documentation
- Inlay Hints (can be disabled)
- Known value names (i.e. Show drive name for corresponding numeric value)
- Bitflag breakdown (i.e. Append inlay hint
(activatable, mousable)
afterattr 3
) - Parameter names (minimum number of parameters before showing hint is configurable)
- Command return values
- Basic code formatting
Extension Settings
This extension contributes the following settings:
General
caosScript.maxNumberOfProblems
: Set maximum number of errors to reportcaosScript.variant
: Workspace CAOS variant. Can be [C1,C2,CV,C3,DS]. Default DScaosScript.formatting.indentComments
: Indent comments inline with commands except when comment is at start of lineInlay Hints
caosScript.inlayHints.bitFlagValues
: Show inlay hints for bitflag valuecaosScript.inlayHints.parameterHints.showParameterHints
: Show parameter names before argumentscaosScript.inlayHints.parameterHints.minimumParameterCount
: Hide inlay hints for commands with less than this number of parameterscaosScript.inlayHints.setvParameterHints
: Show parameter names before SETV like command argumentscaosScript.inlayHints.genusName
: Show genus name for known family/genus combinationscaosScript.inlayHints.valueName
: Show value name for known integer and string valuescaosScript.inlayHints.eventScriptName
: Show event script name for known event numberscaosScript.inlayHints.ddePictDimensions
: ShowDDE: PICT
command dimensions from dimension characterscaosScript.inlayHints.c1ClasValue
: Show parsed family, genus, and specie from C1 CLAS valuecaosScript.inlayHints.rvalueReturnValue
: Show return type for rvalue commandscaosScript.inlayHints.equality.bitFlagValues
: Show Bitflag value on opposing side of equality operatorcaosScript.inlayHints.equalityValueName
: Show value name for know integer and string values on opposing side of EQ
Semantic Tokens
Some CAOS file elements have additional semantic token selectors on them which allows for more specific styling
Main Tokens
command
: root level command name tokensrvalue
: rvalue command name tokenslvalue
: command tokens when command is used as lvalue
Token Modifiers
command-prefix
: First token in a multi-word commandcommand-suffix
: Last token in a three word commandc1-string
: A C1 style bracket stringquote-string
: A C2e style quoted stringbyte-string
: A byte string for things like ANIMnot-found
: For a command that cannot be found in contextvaxx
: for VAxx and VARx variablesovxx
: for OVxx and OBVx variablesmvxx
: For MVxx variablesreturns-number
: Decorates command words for commands that return a numberreturns-string
: Decorates command words for commands returning a stringreturns-variable
: Decorates command word for commands returning a variablereturns-agent
: Decorates command word for commands returning an agentagent-constructor
: Decorates agent constructor commands like those starting withnew:
How to theme semantic tokens
You can these tokens in settings by using
{
"editor.semanticTokenColorCustomizations": {
"[Default Dark+]": {
"*.returns-string:caos": "#ff0011"
}
}
}
Known Issues
- Occasionally completion becomes confused.
- Suggests commands instead of R/L values unexpectedly
- Suggests known values for values already completed previously
- Fails to show suggestions for named values
- Navigation fails from
SUBR
names to their usages
Release Notes
0.1.0
Initial release
Roadmap
- Rename support:
- subroutine (
SUBR
) names GAME
/EAME
/NAME
variable names
- subroutine (
- CAOS2Pray
- Completions
- File name
- Known tags
- Commands
- Highlighting
- Compilation
- Completions
- PRAY file support
- Completions
- Error checking