fix(extension): Improvements

This commit is contained in:
Myzel394 2024-10-20 12:31:17 +02:00
parent 0005d7bf71
commit 739f92fc41
No known key found for this signature in database
GPG Key ID: ED20A1D1D423AF3F
2 changed files with 91 additions and 28 deletions

View File

@ -8,7 +8,7 @@ on:
types: [ published ]
jobs:
build-release:
build-server:
runs-on: ubuntu-latest
steps:
@ -44,13 +44,6 @@ jobs:
exit 1
fi
- uses: cachix/install-nix-action@v27
with:
github_access_token: ${{ secrets.GITHUB_TOKEN }}
- name: Check Flake
run: nix flake check
- name: Set up Go
uses: actions/setup-go@v5
with:
@ -65,3 +58,79 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GH_CONFIGLSP_TOKEN }}
build-extension:
name: Build extension for ${{ matrix.target }}
runs-on: ${{ matrix.os }}
needs:
# Wait for server to build so that we know the checks have passed
- build-server
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-apple-darwin
os: macos-latest
cross: false
- target: aarch64-apple-darwin
os: macos-latest
cross: false
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
cross: false
- target: aarch64-unknown-linux-gnu
os: ubuntu-latest
cross: false
- target: x86_64-pc-windows-msvc
os: windows-latest
cross: false
- target: aarch64-pc-windows-msvc
os: windows-latest
cross: false
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: cachix/install-nix-action@v27
with:
github_access_token: ${{ secrets.GITHUB_TOKEN }}
- name: Check Flake
run: nix flake check
- name: Build extension
run: nix build .#"vs-code-extension"
- name: Rename extension
run: mv result/*.vsix result/$(basename result/*.vsix)-${{ matrix.target }}.vsix
- uses: actions/upload-artifact@v4
with:
path: result/*.vsix
- name: Target to vs code target
id: vscode_target
run: |
if [ "${{ matrix.target }}" = "x86_64-apple-darwin" ]; then
echo "target=darwin-x64" >> $GITHUB_OUTPUT
elif [ "${{ matrix.target }}" = "aarch64-apple-darwin" ]; then
echo "target=darwin-arm64" >> $GITHUB_OUTPUT
elif [ "${{ matrix.target }}" = "x86_64-unknown-linux-gnu" ]; then
echo "target=linux-x64" >> $GITHUB_OUTPUT
elif [ "${{ matrix.target }}" = "aarch64-unknown-linux-gnu" ]; then
echo "target=linux-arm64" >> $GITHUB_OUTPUT
elif [ "${{ matrix.target }}" = "x86_64-pc-windows-msvc" ]; then
echo "target=win32-x64" >> $GITHUB_OUTPUT
elif [ "${{ matrix.target }}" = "aarch64-pc-windows-msvc" ]; then
echo "target=win32-arm64" >> $GITHUB_OUTPUT
fi
- name: Upload extension to VS Code Marketplace
run: nix develop .#"vs-code-extension" --command bash -c "cd result && vsce publish --target ${{ steps.vscode_target.outputs.target }} --packagePath *.vsix"
env:
VSCE_PAT: ${{ secrets.VSCE_TOKEN }}

View File

@ -1,27 +1,21 @@
# LSP Example for Embedded Language using Language Service
# config-lsp for VS Code
Heavily documented sample code for https://code.visualstudio.com/api/language-extensions/embedded-languages#language-services
`config-lsp` provides language support for various config files.
Currently it supports completions, diagnostics, hints, formatting, hover information,
and definition requests.
## Functionality
Install this extension and load your config files in VS Code to get started.
This extension contributes a new language, `html1`. The new language is for illustration purpose and has basic syntax highlighting.
If `config-lsp` is unable to detect the language of your config file, you can manually
specify it by adding a line in the form of:
This Language Server works for `html1` file. HTML1 is like HTML file but has file extension `.html1`. You can create a `test.html1` file to play with below functionalities:
```plaintext
#?lsp.language=<language>
- Completions for HTML tags
- Completions for CSS in `<style>` tag
- Diagnostics for CSS
# For example
## Running the Sample
#?lsp.language=sshconfig
#?lsp.language=fstab
#?lsp.language=aliases
```
- Run `npm install` in this folder. This installs all necessary npm modules in both the client and server folder
- Open VS Code on this folder.
- Press Ctrl+Shift+B to compile the client and server.
- Switch to the Debug viewlet.
- Select `Launch Client` from the drop down.
- Run the launch config.
- If you want to debug the server as well use the launch configuration `Attach to Server`
- In the [Extension Development Host] instance of VSCode, open a HTML document
- Type `<d|` to try HTML completion
- Type `<style>.foo { c| }</style>` to try CSS completion
- Have `<style>.foo { }</style>` to see CSS Diagnostics