A work-in-progress language server for the sitepark markup language (spml).
- go to definition for variables and
<sp:include>taguriattributes - hover for documentation of
- most tags
- most attributes
- global functions in spel attribute values
- diagnostics on:
- syntax errors
- misplaced, unclosed and deprecated tags
- duplicate, required and deprecated attributes / tag-bodies
- nonexistent files in
<sp:include>and similar tags - sitepark expression language (spel):
- syntax errors
- nonexistent global functions
- incorrect argument counts for global functions
- completion for:
- tags
- the last unclosed tag
- attributes
- attribute values that either:
- have a fixed set of possible values
- point to another spml file
- refer to an spml module
- semantic highlighting for attribute values that expect:
- conditions
- expressions
- identifiers
- objects
- regular expressions
- text
- uris
- to be comparable (for
<sp:if>and<sp:elseif>eq/gt/...)
- code actions to:
- generate a default file header
- fix small spel syntax errors (
quickfix) - fix all
quickfix-able errors at once (source.fixAll) - split
<sp:if>conditionintonameandeq/gt/isNull/... - join
<sp:if>nameandeq/gt/isNull/... intocondition
this project also contains the lspml-analyze command to invoke its diagnostic statically.
#$ lspml-analyze --directory src/main/webapp/ --module-file module_mappings.json
src/main/webapp/templates/sectionTypes/bad.spml
[CRITICAL] missing required attribute "name" (MISSING_VALUE) on line 10
[ERROR] included file "/functions/missing.spml" does not exist (MISSING_FILE) on line 24
[WARNING] attribute "object" is useless without attribute "action" containing one of these values: [put, putNotEmpty, putAll, merge] (SUPERFLUOUS_VALUE) on line 12
src/main/webapp/templates/sectionTypes/veryBad.spml
[CRITICAL] missing atleast one header. Try generating one with the "refactor.generate_default_headers" code-action (MISSING_HEADER) on line 1
[CRITICAL] syntax error: unexpected "/" (SYNTAX_ERROR) on line 2
[CRITICAL] syntax error: unexpected ":" (SYNTAX_ERROR) on line 2
When using the gitlab format for code-quality lspml-analyze has to be executed from the projects root directory such that the relative paths in the json output align. It may also be usefull to add --ignore UNKNOWN_MODULE to skip validation of dependencies.
disclaimer: this functionallity will probably become a separate project/binary when it leaves the experimental state!
Usage: lspml [OPTIONS]
Options:
--log-file <LOG_FILE>
--log-level <LOG_LEVEL> [default: INFO]
--modules-file <MODULES_FILE>
-h, --help
The modules-file is a json file, in which module names can be mapped to local repositories like so:
{
"test-module": {
"path": "/absolute/path/to/some/test-module/src/main/webapp"
},
"sitekit-module": {
"path": "/absolute/path/to/some/other/sitekit-module/src/main/webapp"
}
}You can install the binaries without checking this project out via:
cargo +nightly install --git https://github.com/DrWursterich/lspml.gitOr if you have tinkered with it:
cargo +nightly install --path .cargo +nightly build --releaseThis creates the executables lspml and lspml-analyze at ./target/release/ or ./target/debug/ if not using --release
- make sure
*.spmlfiles are associated with thespmlfiletype
vim.filetype.add({
extension = {
spml = "spml",
},
})- manually attach lspml ls
vim.lsp.config('lspml', {
filetypes = { 'spml' },
cmd = {
'/path/to/lspml',
'--log-file', '/path/to/lspml.log.json', -- optional
'--log-level', 'TRACE', -- optional
'--modules-file', '/path/to/module_mappings.json', -- optional
},
root_markers = { 'src', 'pom.xml' },
trace = 'verbose',
})
vim.lsp.enable('lspml')Install the lsp package and follow their setup instructions. A configuration for lspml should look similar to this:
{
"clients": {
"lspml": {
"enabled": true,
"command": [
"/path/to/lspml",
"--modules-file", "/path/to/module_mappings.json",
"--log-file", "/path/to/lspml/lspml.log.json",
"--log-level", "INFO"
],
"selector": "text.html.jsp"
}
}
}The spml-vscode extension wraps lspml and provides all of it's features.