Skip to content

Releases: g-plane/wasm-language-tools

v0.10.4

12 Mar 02:26
v0.10.4
cf9dc77

Choose a tag to compare

Bug Fixes

  • Fixed resolving types in br-like instruction for (loop).

v0.10.1

09 Mar 13:33
v0.10.1
609b7f0

Choose a tag to compare

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.

image

Hover

When hovering on a integer literal, the value of the literal is shown in decimal, hexadecimal and binary.

image

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 declare keyword.
  • 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

07 Feb 03:56
v0.9.0
7ee3215

Choose a tag to compare

Proposals Support

These proposals are supported:

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 here

after 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

27 Dec 12:09
v0.8.0
265aa01

Choose a tag to compare

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 end keyword.
  • formatter: Print exports before import.
  • parser: Restrict parsing of exports and import.
  • syntax: Allow retrieving multiple exports.

v0.7.1

27 Nov 03:13
v0.7.1
1fa8caf

Choose a tag to compare

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

v0.7.0

15 Nov 13:36
v0.7.0
a15d9ee

Choose a tag to compare

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.const and 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_parens option.
  • formatter: Removed config_serde feature flag.
  • parser: Added support of address type.
  • syntax: Renamed EXPORT_DESC to EXTERN_IDX.
  • syntax: Renamed IMPORT_DESC to EXTERN_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 null to inherit global config.
  • service: Treat local.tee as a "write" highlight.
  • service: Fixed type checking in if block with param type.
  • service: Fixed possible panic due to data race.
  • service: Added missing completion for then keyword.
  • 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 then block with trivias.

v0.6.1

05 Oct 12:52
v0.6.1
e7b9724

Choose a tag to compare

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

29 Sep 10:07
v0.6.0
bb5fb26

Choose a tag to compare

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 SyntaxError definition.
  • service: Removed is_cancelled method.
  • service: Added support of "mutable" modifier in semantic tokens.
  • service: Added handlers for LSP didOpen and didClose notifications.
  • parser: Renamed parse_to_green to parse and dropped old parse.

Fixes

  • service: Fixed false positive about missing else block.
  • service: Fixed renaming different kinds of idx.

v0.5.1

23 Jun 03:55
v0.5.1
ee284e7

Choose a tag to compare

Fixes

  • service: Fixed label in nested if block.

v0.5.0

14 May 07:24
v0.5.0
0e0da63

Choose a tag to compare

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 func keyword in module field elem.
  • service: Added completions for instructions in module field table.
  • service: Added completions for ref keyword 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 item keyword.
  • formatter: Fixed formatting implicit module.
  • formatter: Added missing node kinds in range formatting.