Skip to content

Release Notes 2.0.0

SPGoding edited this page Aug 13, 2020 · 11 revisions

Datapack Language Server 2.0.0

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.

💥 Breaking Changes

There are some breaking changes that might make the language server no longer work properly for you.

Dropped Old VS Code

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.

Settings Changes

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.

✨ Features

Semantic Coloring

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!

semantic-coloring

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.

Q: Can I customize the colors? They are ugly!

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:

Semantic Token Types

  • annotation
  • boolean
  • comment
  • entity
  • keyword
  • literal
  • identity
  • number
  • operator
  • property
  • string
  • type
  • variable
  • vector

Semantic Token Modifiers

  • declaration
  • deprecated
  • documentation
  • firstArgument

Default Styles

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.

Q: Can I disable your semantic coloring?

Yes, by turning either editor.semanticHighlighting.enabled or datapack.features.semanticColoring off in your settings.

New NBT validations and completions

From this version on, the language server will use Yurihaia's mc-nbtdoc internally for NBT validations and completions.

nbt-hover-information

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!

Code Actions

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.

code-action

List of Code Actions

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

New Features Settings

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.

New Envionment Options

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.

dataSource

The download source of the completion data.

Available options

  • "GitHub": (Default) Download those data from raw.githubusercontent.com.
  • "码云": Download those data from gitee.com. You can choose this if raw.githubusercontent.com is blocked in your country/region.

dependsOnVanilla

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.

Available options

  • true: (Default) Enable.
  • false: Disable.

exclude

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.

Example

{
    "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.

include

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.

Example

{
    "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.

New #alias comment

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>

alias-comments

New #define comment

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.

define-score_holder

Support /attribute command

The /attribute command added in Minecraft: Java Edition 20w17a was supported.

🐛 Bugfixes

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.

🕙 Future Plans

See all backlogged issues: query.

💛 Thank You

A big thank you goes to these wonderful people! (sorted by the Unicode of names)


឵!Onnowhere
🐛 #376
00ll00
☕ Donate coffee
🐛 #408
🐛 #422

Arcensoth
⬆️ Maintains mcdata repository
ChenCMD
✨ #358
🐛 #368
🐛 #369
🐛 #379
🐛 #409
🐛 #411
🐛 #413
🐛 #417
🐛 #423
🐛 #424
🐛 #430
🐛 #443
🐛 #457
🐛 #459
🌍 for Japanese (ja)

Cjsah_
🐛 #437
🐛 SPGoding/datapack-json#40

ColorRain_Tree
💛 (#°Д°)

Ellivers
🐛 #442
Feierwoerx
🌍 for German (de)

Foobin
🐛 #398
Jerozgen
🐛 #364
🐛 #365

K_bai
☕ Donate coffee
Misode
✨ #238
🐛 #375
🐛 #384
🐛 #386

MulverineX
🐛 #401
Red_Bones
🐛 SPGoding/datapack-json#41

ShoukaSeikyo
🐛 #451
Yurihaia
⬆️ Maintains mc-nbtdoc repository

kakagRou
☕ Donate coffee
liudaifeng55
🐛 #453

martin_zzy
🐛 #353
missinggo
🐛 #438
🐛 #439
✨ #469

mathaym25
✨ #382
🐛 #385

ncfumction
🐛 #376
🐛 #392
✨ #393

shurik204
🐛 #455
ひろ at Github
🐛 #475

酱香卤鹅
☕ Donate coffee
龙腾猫跃
☕ Donate coffee

This project follows the all-contributors specification. Contributions of any kind are welcome!

Looking to contribute?

Thanks a lot! Please check the contributing guide to learn more about how to contribute!

Clone this wiki locally