Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement a language server extension for Visual Studio Code #259

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

jow-
Copy link
Owner

@jow- jow- commented Dec 30, 2024

This PR introduces a vscode extension for improved ucode support
within the IDE. It features auto complete suggestions as well as
semantic syntax highlighting, compile time error reporting and support
for JSDoc type annotations in variable or function declarations.

As part of the vscode extensions, a new ucode library "uscope" is
introduced which provides facilities for static ucode source analysis,
e.g. to determine the validity scope of variable declarations or to
properly tokenize ucode sources.

This is work in progress, as various kinks need to be sorted out still.

jow- added 5 commits December 30, 2024 01:46
Introduce two new helper functions for dealing with ucode values:

 - `ucv_is_strictly_equal(v1, v2, treat_nan_equal)`
   This function implements strict value comparison rules as defined for
   the `===`, `!==` and `in` operators. This is useful for code dealing
   with uc values outside of the VM execution context.

 - `ucv_contains(haystack, needle)`
   This function implements the semantics of the `in` operator, it checks
   whether a given array or object contains a given value or key string
   respectively.

Signed-off-by: Jo-Philipp Wich <[email protected]>
Drop the VM specific implementation in favor to the generic types.c
helper functions.

Signed-off-by: Jo-Philipp Wich <[email protected]>
Factor out the core arithmetic operations from `vm.c`, move them into
a separate `arith.c` compilation unit and expose two new helper functions
`ucv_arith_unary()` and `ucv_arith_binary()` allowing the computation of
numeric operations on ucode values outside of the VM context.

This is intended for use-cases where evaluation of simple ucode expressions
is required, e.g. within a debugger module or a code intelligence context
within a language server.

Signed-off-by: Jo-Philipp Wich <[email protected]>
Use the factored out `arith.c` routines to implement arithmetic operations
for ucode values and remove the local implementations from the VM.

As a result, the instruction handling is slightly simplified and the amount
of code reduced.

Signed-off-by: Jo-Philipp Wich <[email protected]>
This commit introduces a vscode extension for improved ucode support
within the IDE. It features auto complete suggestions as well as
semantic syntax highlighting, compile time error reporting and support
for JSDoc type annotations in variable or function declarations.

As part of the vscode extensions, a new ucode library "uscope" is
introduced which provides facilities for static ucode source analysis,
e.g. to determine the validity scope of variable declarations or to
properly tokenize ucode sources.

Signed-off-by: Jo-Philipp Wich <[email protected]>
@jow- jow- marked this pull request as draft December 30, 2024 00:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant