Releases: g-plane/wasm-language-tools
v0.10.4
v0.10.1
Proposals Support
These proposals are supported:
Visit WebAssembly Features Status page for details about the supported features.
Lints and Checks
Params in function type definitions won't be reported as unused
Parameters in function type definitions won't be reported as unused params any more. For example:
(module
(type (func (param i32))))no parameters above will be reported as unused.
Completions
When completing composite types, there're will be hints after their names.
Hover
When hovering on a integer literal, the value of the literal is shown in decimal, hexadecimal and binary.
Other Changes
- Ranges of items in "Call Hierarchy" view are shrunk.
- Deprecated items are now shown with strikethrough in "Call Hierarchy" view and "Type Hierarchy" view.
Bug Fixes
- Fixed possible stack overflow in type-checking.
- Fixed false "unused" element segments with
declarekeyword. - Fixed incorrect reports of uninitialized locals in some cases.
Engineering
We've re-implemented the syntax tree library by ourselves instead of using rowan, which leads a significant performance improvement.
See the pull request for details.
v0.9.0
Proposals Support
These proposals are supported:
- Compilation Hints
- Bulk Memory Operations: this proposal was supported before, but dataidx and elemidx not recognized, and this release adds this.
Visit WebAssembly Features Status page for details about the supported features.
Lints and Checks
"unreachable" check removed from global expression
The "unreachable" check won't be performed on global initialization expression any more.
Reject multiple start sections
A module that contains multiple start sections now will be reported as errors:
(module
(func)
(start 0)
(start 0))Engineering
We have optimized the performance of running checks for diagnostics. In our benchmark, the check time goes down from 103µs to 35µs, which achieved a 2.9x speedup. The factor may differ according to your project.
Since some optimizations are shared, performance of some other language server functionalities is also improved.
Code Actions
Add result types according to type checking
If a function or a block doesn't have result types but its body returns and causes type mismatch, a quick fix is available for adding result types to that function or block:
(module
(func
i32.const 0)) ;; type mismatch hereafter applying this quick fix:
(module
(func (result i32)
i32.const 0))Parser
Identifiers that contain quoted name such as $"quoted name" are supported.
Fixes
- service: Fixed detecting implicit table usage.
- service: Fixed recognizing hexadecimal numeric idx.
- service: Fixed panic when using in Emacs with lsp-mode.
- service: Fixed inserting text before a module.
- parser: Fixed parsing table type with addr type.
v0.8.0
Proposals Support
These proposals are supported:
Visit WebAssembly Features Status page for details about the supported features.
Lints and Checks
Reworked unreachable code detection and uninitialized locals check
The unreachable code detection and uninitialized locals check are based on syntax tree previously, especially the uninitialized locals check often reports false positives and false negatives because of the lack of the knowledge of control flow.
We have added control flow analysis to the language service and now both checks are based on control flow graph, which significantly improves the accuracy of the checks.
New check for unread function locals
Language service now can check for function locals that are set with local.set or local.tee but never read with local.get. By the way, this check is also based on the control flow graph we mentioned above.
New check for imported items with definitions
For imported functions, globals, memories, tables, or tags, language service now checks if they have definitions like function locals, function bodies, or global initializers.
Completions
Refined completions list for instructions in constant expressions
When providing completions for instructions in constant expressions, language service now only suggests "constant" instructions instead of all instructions.
Code Actions
Export as the same name with identifier
This code action can add an export for a function, global, memory, table, or tag with the same name as its identifier:
(module
(func $add))will become
(module
(func $add (export "add")))Extract or inline export
Two new code actions can help to extract the export syntax to a separated module field or inline to the definition. For example, converting
(module
(func $add (export "add")))to
(module
(func $add)
(export "add" (func $add)))or vice versa.
Merge to return_call
When a call instruction is the last instruction in a function body and it calls the function itself, or a call which calls the function itself is followed by a return instruction, this code action can help to rewrite to a return_call instruction.
Expand or simplify ref type
Two new code actions can help to convert ref types between two kinds of forms. For example, converting funcref to (ref null func) or vice versa.
Join or split struct fields
Struct fields can be joined or splitted by code actions. This is just similar to the existing code actions for function parameters, results, and locals.
Remove syntaxes without types
This code action can help to remove function parameters, results, locals, and struct fields that do not have types specified. For example, removing the param, result, local and field parts below:
(module
(func (param) (result) (local))
(type (struct (field))))but not the functions or structs themselves.
Formatter
The formatting behavior of function locals and struct fields can be customized more flexibly with new options.
The wrapBeforeLocals and wrapBeforeFields option can control whether to insert a line break before the whole function locals or struct fields.
The multiLineLocals and multiLineFields option can control whether to insert a line break between each individual function local or struct field.
The wrapBeforeConstExpr option can control whether to insert a line break before constant expressions (not each instruction) which are under global initializers, etc.
Code Navigation
"Go to Type Definition" now expands support to composite types.
Fixes
- service: Fixed panic when inserting comment.
- service: Fixed type checking on imported function.
- formatter: Fixed trailing whitespaces before
endkeyword. - formatter: Print exports before import.
- parser: Restrict parsing of exports and import.
- syntax: Allow retrieving multiple exports.
v0.7.1
Highlights
This release contains no new features, but platform support is expanded: We now provide prebuilt binaries for Linux ARM64 (including glibc and musl) and Linux x86_64 (musl).
Before this release, when there're no prebuilt binaries for your platform, the VS Code extension will show an error message and prompt you to install it manually. With this release, the extension will fall back to use a built-in WebAssembly-based language server.
Speaking of VS Code, the VS Code extension can be used in VS Code for Web, so you can use the language server in browsers.
Since this release, you can run cargo binstall wat_server to install the server without building from source.
Fixes
- server: Fixed initial diagnostics not appeared after opened in some editors like Neovim.
API Changes
- service:
LanguageService::set_configandLanguageService::commitnow acceptimpl AsRef<str>as URI.
v0.7.0
Highlights
This release brings Wasm 3.0 support, including features such as exception handling, custom annotations, and more.
By supporting custom annotations, functions, globals and other items can be marked as deprecated with an optional reason. Read more about how to mark deprecated.
Features
- server: Refresh inlay hint after config changed.
- service: Added granular inlay hint options.
- service: Show numeric index in inlay hint.
- service: Added code lens.
- service: Check immediates of
i8x16.shuffle. - service: Added support of
v128.constand shape descriptor. - service: Added relaxed SIMD instructions.
- service: Check table ref type in
call_indirect. - service: Check result type of
return_call*instructions. - service: Added more const instructions.
- service: Removed "multiple memories" lint.
- service: Removed outdated description of reference types.
- service: Added support of marking deprecated.
- formatter: Optimized trivias after left paren.
- formatter: Changed handling indentation and right paren.
- formatter: Added
split_closing_parensoption. - formatter: Removed
config_serdefeature flag. - parser: Added support of address type.
- syntax: Renamed
EXPORT_DESCtoEXTERN_IDX. - syntax: Renamed
IMPORT_DESCtoEXTERN_TYPE.
Fixes
- service: Fixed inlay hint config deserialization.
- service: Added missing instructions.
- service: Fixed checking immediates of
table.*instructions. - service: Check for non-defaultable table type.
- service: Added a missing case of heap type matching.
- service: Allow config to be
nullto inherit global config. - service: Treat
local.teeas a "write" highlight. - service: Fixed type checking in
ifblock with param type. - service: Fixed possible panic due to data race.
- service: Added missing completion for
thenkeyword. - formatter: Added missing nodes for range formatting.
- formatter: Fixed trivias before result in type use.
- formatter: Fixed trivias without module fields.
- parser: Prevent duplicated error reports.
- parser: Prevent infinite loop on unterminated strings.
- parser: Fixed missing folded
thenblock with trivias.
v0.6.1
Features
- service: Changed finding references for undefined and duplicated symbols.
- service: Added support of type use with type idx in function.
Fixes
- service: Fixed data-race panic when config is pulled.
v0.6.0
We have rewritten the parser, and the parser performance is increased by 350%. Also, the language service has been optimized. With the new parser and the optimizations itself, the language service performance is increased by 40%.
Features
- Lifted up mem arg as syntax node instead of token.
- parser: Dropped shared keywords support.
- parser: Changed
SyntaxErrordefinition. - service: Removed
is_cancelledmethod. - service: Added support of "mutable" modifier in semantic tokens.
- service: Added handlers for LSP
didOpenanddidClosenotifications. - parser: Renamed
parse_to_greentoparseand dropped oldparse.
Fixes
- service: Fixed false positive about missing
elseblock. - service: Fixed renaming different kinds of idx.
v0.5.1
Fixes
- service: Fixed label in nested if block.
v0.5.0
Features
- Added support of expression in module field table.
- service: Recognize funcidx in elem list.
- service: Recognize tableidx in table use.
- service: Detect typeidx in
ref.null. - service: Added completions of funcidx after
funckeyword in module field elem. - service: Added completions for instructions in module field table.
- service: Added completions for
refkeyword in table type. - service: Added support of type checking in module field table.
- service: Added support of type checking in elem list.
- service: Added support of type checking in offset.
- service: Check mem type.
- service: Check table expression if it is constant.
- service: Check offset expression if it is constant.
- service: Check elem expression if it is constant.
- service: Check ref type in module field elem.
- service: Added support of hovering on memory.
- service: Added support of hovering on table.
Fixes
- service: Fixed completion of
itemkeyword. - formatter: Fixed formatting implicit module.
- formatter: Added missing node kinds in range formatting.