-
Notifications
You must be signed in to change notification settings - Fork 34
Release Notes 2.0.0
- Datapack Language Server 2.0.0
- 💥 Breaking Changes
- ✨ Features
- 🐛 Bugfixes
- 🕙 Future Plans
- 💛 Thank You
After two months of working, we finally got 2.0.0!
If you like this update, you can consider contributing by sponsoring, reporting bugs/sharing ideas, or helping localization.
There are some breaking changes that might make the language server no longer work properly for you.
We dropped support for VS Code older than 1.44.0 (exclusive) to provide semantic coloring. Please make sure that you are using a version of VS Code later than that.
Wiki: https://github.com/SPGoding/datapack-language-server/wiki/Lint-Rules
All setting IDs of the language server were simplified from datapackLanguageServer.xxx
to datapack.xxx
.
Many linting settings were deleted, renamed, changed, or splitted. We now have a wiki introducing all these lint rules with examples.
Here are all the changes of linting settings between 1.13.8 and 2.0.0:
1.13.8 Setting | Operation | 2.0.0 Setting |
---|---|---|
env.version |
Renamed | env.cmdVersion |
lint.blockStateAppendSpaceAfterComma |
Renamed & Changed Format | lint.blockStateCommaSpacing |
lint.blockStatePutSpacesAroundEqualSign |
Renamed & Changed Format | lint.blockStateEqualSpacing |
lint.blockStateSortKeys |
Changed Format | lint.blockStateSortKeys |
lint.enableFormatting |
Renamed | features.formatting |
lint.entitySelectorAppendSpaceAfterComma |
Renamed & Changed Format | lint.selectorCommaSpacing |
lint.entitySelectorKeyOrder |
Renamed & Changed Format | lint.selectorSortKeys |
lint.entitySelectorPutSpacesAroundEqualSign |
Renamed & Changed Format | lint.selectorEqualSpacing |
lint.nameOfSnbtCompoundTagKeys |
Renamed | lint.nameOfNbtCompoundTagKeys |
lint.omitDefaultNamespace |
Renamed & Changed Format | lint.idOmitDefaultNamespace |
lint.quoteEntitySelectorKeys |
Renamed & Changed Format | lint.selectorKeyQuote |
lint.quoteSnbtStringKeys |
Renamed & Changed Format | lint.nbtCompoundKeyQuote |
lint.quoteSnbtStringValues |
Renamed & Changed Format | lint.nbtStringQuote |
lint.quoteType |
Splitted & Changed Format | lint.nbtCompoundKeyQuoteType |
lint.quoteType |
Splitted & Changed Format | lint.nbtPathQuoteType |
lint.quoteType |
Splitted & Changed Format | lint.nbtStringQuoteType |
lint.quoteType |
Splitted & Changed Format | lint.selectorKeyQuoteType |
lint.quoteType |
Splitted & Changed Format | lint.stringQuoteType |
lint.snbtAppendSpaceAfterColon |
Renamed & Changed Format | lint.nbtCompoundColonSpacing |
lint.snbtAppendSpaceAfterComma |
Splitted & Changed Format | lint.nbtArrayCommaSpacing |
lint.snbtAppendSpaceAfterComma |
Splitted & Changed Format | lint.nbtCompoundCommaSpacing |
lint.snbtAppendSpaceAfterComma |
Splitted & Changed Format | lint.nbtListCommaSpacing |
lint.snbtAppendSpaceAfterSemicolon |
Renamed & Changed Format | lint.nbtArraySemicolonSpacing |
lint.snbtByteSuffix |
Renamed | lint.nbtByteSuffix |
lint.snbtDoubleSuffix |
Renamed | lint.nbtDoubleSuffix |
lint.snbtFloatSuffix |
Renamed | lint.nbtFloatSuffix |
lint.snbtKeepDecimalPlace |
Deleted | - |
lint.snbtLongSuffix |
Renamed | lint.nbtLongSuffix |
lint.snbtShortSuffix |
Renamed | lint.nbtShortSuffix |
lint.snbtSortKeys |
Renamed & Changed Format | lint.nbtCompoundSortKeys |
lint.snbtUseBooleans |
Renamed & Changed Format | lint.nbtBoolean |
You can see the wiki to see the formats and examples of all linting rules.
Wiki: https://github.com/SPGoding/datapack-language-server/wiki/Semantic-Coloring
VS Code 1.44.0 finalized its semantic tokens API, however the relevant API in vscode-languageserver-node are still in proposed stage.
We have already implemented semantic coloring for almost four months, and I can't wait for LSP anymore to get it in the production environment. So... here it comes!
To experience this feature, please make sure that both editor.semanticHighlighting.enabled
and datapack.features.semanticColoring
are set to true
.
Q: Can I still install Arcensoth's language-mcfunction, another VS Code extension that provides syntax highlighting for mcfunctions?
Yes, and we encourage you to do so! Arcensoth's language-mcfunction extension uses TextMate grammar which is based on regular expressions and computed on client side, while the language server's semantic coloring is based on semantic tokens and computed on server side. As a result, the process time of language-mcfunction is much shorter than the language server. By using both extensions, you can get immediate feedback from Arcensoth's extension while typing commands, which might be replaced with a more accurate color provided by the language server.
Also, there are some drawbacks of the semantic coloring provided by the language server, mostly by design:
- The language server doesn't provide coloring for text components, while Arcensoth's language-mcfunction does. This is because the server uses VS Code's vscode-json-languageservice package to provide completions and validations for text components, which doesn't support semantic coloring.
- The language server doesn't provide coloring for punctuations, like the brackets and commas in entity selectors, while Arcensoth's language-mcfunction does.
Yes, for sure! In fact the language server doesn't provide any actual colors; it only provides several semantic tokens that will be interpreted to different colors by your theme in VS Code.
You can see VS Code's documentation about how to change those colors. Hereby we provide you all the semantic token types and semantic token modifiers used by the language server:
annotation
boolean
comment
entity
keyword
literal
identity
number
operator
property
string
type
variable
vector
declaration
deprecated
documentation
firstArgument
For language mcfunction
:
Semantic Token Selector | TextMate Scope | Note |
---|---|---|
annotation |
markup.heading.annotation.mcfunction |
A doc comment annotation |
boolean |
constant.language.boolean.mcfunction |
A boolean value |
comment |
N/A | - |
entity |
support.class.entity.mcfunction |
An entity or a score holder |
keyword |
N/A |
.. in number ranges and time units |
literal |
keyword.other.mcfunction |
A literal argument |
literal.firstArgument |
keyword.control.mcfunction |
The first literal argument in each command |
identity |
entity.name.function |
An namespaced ID |
number |
N/A | - |
operator |
N/A |
matches , = , /= , etc. |
property |
N/A | Map keys |
string |
N/A | - |
type |
N/A | Item/scoreboard slots and objective criteria |
variable |
N/A | Objectives, teams, and tags |
vector |
constant.numeric.vector.mcfunction |
A vector |
-
N/A
means that this token is a standard token and is implemented in VSCode by default.
Yes, by turning either editor.semanticHighlighting.enabled
or datapack.features.semanticColoring
off in your settings.
From this version on, the language server will use Yurihaia's mc-nbtdoc internally for NBT validations and completions.
As a result, the language server can:
- Download NBT complection data for new Minecraft versions from mc-nbtdoc, without updating the language server itself.
- Provide detailed descriptions for each key in NBT compound tags when computing completions.
- Show those descriptions when you hover your cursor on NBT keys.
- By the way, by using mc-nbtdoc, we already fixes many bugs without even knowing them!
Thank Yurihaia for making such an awesome repository!
Wiki: https://github.com/SPGoding/datapack-language-server/wiki/Code-Actions
The language server can now provide some code actions to help fix problems in your commands! Well, if there are any, obviously.
Key | Name | Ex. Before | Ex. After |
---|---|---|---|
block-state-sort-keys |
Sort block state | - | To the order specified in datapack.lint.blockStateSortKeys
|
id-attribute-datafix |
Update this attribute name to 1.16 | "generic.maxHealth" |
"generic.max_health" |
id-complete-default-namespace |
Complete default namespace | foo |
minecraft:foo |
id-omit-default-namespace |
Omit default namespace | minecraft:foo |
foo |
nbt-compound-sort-keys |
Sort NBT compound tag | - | To the order specified in datapack.lint.nbtCompoundSortKeys
|
nbt-uuid-datafix |
Update this UUID to 1.16 | {UUIDMost:1L,UUIDLeast:2L} |
{UUID:[I;0,1,0,2]} |
selector-sort-keys |
Sort selector argument | - | To the order specified in datapack.lint.selectorSortKeys
|
string-double-quote |
Quote this string with double quotation marks | 'foo' |
"foo" |
string-single-quote |
Quote this string with single quotation marks | "foo" |
'foo' |
string-unquote |
Unquote this string | "foo" |
foo |
vector-align-0.0 |
Align this vector to block origin | 1.2 3 4 |
1.2 3.0 4.0 |
vector-align-0.5 |
Align this vector to block center | 1.2 3 4 |
1.2 3.5 4.5 |
Wiki: https://github.com/SPGoding/datapack-language-server/wiki/Features-Settings
You can now turn off unwanted features provided by DHP in settings.
Key | Description |
---|---|
datapack.features.codeActions |
Quickfixes and refactor actions. |
datapack.features.colors |
Color information for dust particles and certain NBT values. |
datapack.features.completions |
Code suggestions and completions. |
datapack.features.documentHighlighting |
Highlight relevant words when you hover your cursor on them. |
datapack.features.documentLinks |
Resolving namespaced IDs as links which you can click on. |
datapack.features.foldingRanges |
Folding ranges. |
datapack.features.formatting |
Formatting. |
datapack.features.hover |
Hover information. |
datapack.features.semanticColoring |
Semantic coloring. |
datapack.features.selectionRanges |
Selection ranges. To be honest, even myself don't know what this is. |
datapack.features.signatures |
The signature information which shows the syntax of the current command. |
Wiki: https://github.com/SPGoding/datapack-language-server/wiki/Env-Options
Four new environment options were added in this version: env.dataSource
, env.dependsOnVanilla
, env.exclude
, and env.include
.
The download source of the completion data.
-
"GitHub"
: (Default) Download those data fromraw.luolix.top
. -
"码云"
: Download those data fromgitee.com
. You can choose this ifraw.luolix.top
is blocked in your country/region.
Whether this datapack depends on the vanilla datapack or not. If this option is enabled, completions for the corresponding data of the vanilla datapack will be provided.
-
true
: (Default) Enable. -
false
: Disable.
Files that should be excluded from validation. Each string in this array will be interpreted as a glob pattern to test the relative file paths from the root of the datapack.
{
"datapack.env.exclude": [
"data/spgoding/functions/generated/**/*.mcfunction"
]
}
This will make the language server not validate any mcfunction
files under the
data/spgoding/functions/generated/
directory.
Files that should be included from validation. Each string in this array will be interpreted as a glob pattern to test the relative file paths from the root of the datapack.
This option takes priority over exclude
.
{
"datapack.env.exclude": [
"data/spgoding/functions/generated/**/*.mcfunction"
],
"datapack.env.include": [
"data/spgoding/functions/generated/special.mcfunction"
]
}
This will make the language server not validate any mcfunction
files under the
data/spgoding/functions/generated/
directory, except
data/spgoding/functions/generated/special.mcfunction
.
Wiki: https://github.com/SPGoding/datapack-language-server/wiki/Alias-Comment
#alias
comments are a way to define a string that will be shown in the completion list which will
insert a different value when selected.
Syntax: #alias <parser: string> <alias: string> <value: string>
Wiki: https://github.com/SPGoding/datapack-language-server/wiki/Define-Comment
Apart from the exsiting #define
types, a new type score_holder
was added.
score_holder
is similar to entity
, but it will only be suggested for entity arguments that are score holders.
The /attribute
command added in
Minecraft: Java Edition 20w17a was supported.
Notable fixes:
- #364 - Missing some gamerules.
- #415 - The language server suspends because of unclosed NBT array tags.
- #427 - Settings don't update promptly after changed.
- Various completion bugs of escaping.
- Various formatter bugs.
- Various known and unknown NBT bugs.
- Various text component bugs.
See all known 32 bugs that are fixed in 2.0.0: query.
See all backlogged issues: query.
A big thank you goes to these wonderful people! (sorted by the Unicode of names)
This project follows the all-contributors specification. Contributions of any kind are welcome!
Thanks a lot! Please check the contributing guide to learn more about how to contribute!