A Vue web application that is used by Sumneko's Lua VS Code extension. The extension allows users to open a webview that contains this webapp. This webapp gives users a reactive and first-party looking UI to manage their addons.
This webapp is not intended to be run outside of VS Code, as it depends on the VS Code API in order to perform filesystem actions and commands specific to VS Code.
For using with Sumneko's VS Code extension, you can follow these steps:
-
Clone this repository
-
npm i
in the root to install dependencies -
npm run build
to have Vite build the app into thebuild/
directory -
The
build/
directory can be copied toclient/webvue/
in the Lua VS Code extension.
After following those steps, the build folder should now be found at client/webvue/build/
in the vscode-lua
directory.
After launching VS Code, the extension will be enabled and the Lua: Open Addon Manager
(lua.addon_manager.open
) command will be registered. Running this command in VS Code will open this webapp.
Because this webapp depends on the VS Code API, it has a bit of an odd development/testing method.
In order to not have to build the webapp and reload VS Code every time a small change is made, the VS Code extension will instead load the Vite development server in an iframe. This allows changes to the webapp to immediately show in VS Code, but also has some drawbacks.
Because the webapp is being displayed in an iframe… in an iframe, the message
s that are exchanged between VS Code and the webview have to be relayed by the webview to the inner development iframe. This means that popups/target="_blank"
will not function (setting the sandbox
attribute allows popups, but ends up breaking everything else).
- VS Code
- NodeJS & NPM
First, we will have to set up the VS Code extension.
- Extension setup
-
Run
git clone --recurse-submodules $REPO
, where$REPO
is your preferred clone URL fromvscode-lua
. -
Download a language server binary from
lua-language-server
for your machine. -
Unzip the compressed file and copy its contents to your
vscode-lua
clone under theserver/
directory. -
In the
client/
folder, runnpm i
to install dependencies for the client. -
Run
tsc --watch
in theclient/
folder. This will compile all TypeScript changes to the client as they happen.
-
Note You will want to open another terminal window to run the following steps in.
-
WebVue setup
- Move to
client/webuve
- Run
npm i
to install dependencies inclient/webvue
. - Run
npm run dev
to start a Vite local server.
- Move to
-
Testing in VS Code
- You can now edit the files in
client/
to modify the VS Code extension, and the files inclient/webvue/
to edit this webapp. - Open your
vscode-lua
clone in VS Code, go to theRun and Debug
menu, and run theLaunch Client
option. This will open an extension development window of VS Code where you can test your changes.
- You can now edit the files in