Closed tamasfe closed 2 years ago
the vscode extension can be standalone now with the LSP bundled with it.
Do we need to make pre-built binaries? Or everything in wasm?
Do we need to make pre-built binaries? Or everything in wasm?
No need for platform-specific stuff, all WASM. The native cli is still a lot better for debugging and faster development, the vscode extension can use both.
For some reason the latest drop fails to start:
Error: Cannot find module '@rhaiscript/lsp'
Require stack:
- c:\Users\Stephen\.vscode\extensions\tamasfe.rhai-0.0.0\dist\server.js
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:987:15)
at Module._load (node:internal/modules/cjs/loader:832:27)
at Function.c._load (node:electron/js2c/asar_bundle:5:13343)
at Module.require (node:internal/modules/cjs/loader:1059:19)
at require (node:internal/modules/cjs/helpers:102:18)
at Object.<anonymous> (c:\Users\Stephen\.vscode\extensions\tamasfe.rhai-0.0.0\dist\server.js:1:105)
at Module._compile (node:internal/modules/cjs/loader:1163:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1216:10)
at Module.load (node:internal/modules/cjs/loader:1035:32)
at Module._load (node:internal/modules/cjs/loader:876:12) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'c:\\Users\\Stephen\\.vscode\\extensions\\tamasfe.rhai-0.0.0\\dist\\server.js'
]
}
OK, I think something that has to do with the fact that Windows does not have symbolic links.
So the build on lsp
failed because core
couldn't be found.
Fixing...
OK, I got stuck on this:
$ vsce package --no-yarn
Executing prepublish script 'npm run vscode:prepublish'...
> rhai@0.0.0 vscode:prepublish
> yarn build
yarn run v1.22.19
warning rhai@0.0.0: The engine "vscode" appears to be invalid.
$ rm -rf dist && yarn build:syntax && yarn build:node
warning rhai@0.0.0: The engine "vscode" appears to be invalid.
$ js-yaml syntax/rhai.tmLanguage.yaml > syntax/rhai.tmLanguage.json
warning rhai@0.0.0: The engine "vscode" appears to be invalid.
$ rollup -c rollup.config.js
src/server.ts, src/extension.ts → dist...
(!) Circular dependency
node_modules/semver/classes/comparator.js -> node_modules/semver/classes/range.js -> node_modules/semver/classes/comparator.js
created dist in 6.3s
Done in 7.53s.
This extension consists of 1950 files, out of which 564 are JavaScript files. For performance reasons, you should bundle your extension: https://aka.ms/vscode-bundle-extension . You should also exclude unnecessary files by adding them to your .vscodeignore: https://aka.ms/vscode-vscodeignore
ERROR invalid relative path: extension/../../js/core/node_modules/@rollup/plugin-commonjs/dist/cjs/index.js
The relative paths ../js/core/
etc. are really tripping up Windows.
Great, js environments are always a pain, I can't even imagine it on windows. I've fought with relative local packages in yarn before even on linux.
Alternatively we can publish the packages on npm and just pull them from there in the extension. That's what I intend to do anyway I just didn't want to publish WIP stuff if it's not necessary.
I'm just trying to resolve it such that it builds...
I know, you can try yarn pack
, or npm pack
and then add the .tar.gz
as a dependency, it should be pretty similar to pulling it from npm.
I'll boot up a vm and see if I can get it working as well.
This occurs when I cleaned it up and changed file:../
to ../
Running yarn
in editors/vscode
$ yarn
yarn install v1.22.19
info No lockfile found.
[1/5] Validating package.json...
warning rhai@0.0.0: The engine "vscode" appears to be invalid.
[2/5] Resolving packages...
error Package "" refers to a non-existing file '"C:\\Git\\rhai-lsp\\editors\\core"'.
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
Well, I'm totally stuck. I can't build the thing on Windows.
Something to do with yarn
and not find the rollup
command and broken relative paths etc.
I've spun up a small cloud Ubuntu VM and tried it there, but it seems to have loads of trouble as well. Probably the toolchain not being setup completely...
Alright, I've went through the steps in an almost empty windows vm and updated the readme with them on master.
Ah, so it seems yarn install --force
is the missing command that I omitted!
The extension builds cleanly except for a few warnings:
warning rhai@0.0.0: The engine "vscode" appears to be invalid.
$ yarn build:syntax && yarn build:node
warning rhai@0.0.0: The engine "vscode" appears to be invalid.
$ js-yaml syntax/rhai.tmLanguage.yaml > syntax/rhai.tmLanguage.json
warning rhai@0.0.0: The engine "vscode" appears to be invalid.
$ rollup -c rollup.config.js
I wonder if we can make a rebuild shell script to automate this, although I guess it shouldn't be difficult to manually rebuild.
The following was added:
rhai-cli
crate with therhai
executable, this currently has only thelsp
in it, but I plan to merge the existing repl implementations and a formatter in the futurerhai-common
for common types shared between the lsp and the cli (such as theRhai.toml
config, logging configuration, etc.)rhai-wasm
a wasm wrapper currently only exposing the LSP to javascriptjs/core
andjs/lsp
, these are the js libraries that are supposed to be consumed, they are not published anywhere and are used locally by the vscode extension, I squatted the@rhaiscript
org over npm in case we want to publish them (e.g. for usage of the lsp in the browser).I pretty much copied the architecture I use for publishing stuff for
taplo
.