Skip to content

feat: implement transparent language server client #25

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

Merged
merged 21 commits into from
Mar 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 9 additions & 13 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,17 @@ on:
jobs:
package:
runs-on: ubuntu-20.04
defaults:
run:
shell: nix develop -c bash {0}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
- uses: actions/checkout@v3
with:
node-version: '16.x'
- uses: actions/cache@v2
with:
path: '**/node_modules'
key: ${{ runner.os }}-modules-${{ hashFiles('**/package-lock.lock') }}
- name: Install dependencies
run: npm ci
- name: Install vsce
run: npm install -g [email protected]
- name: Package extension
run: vsce package --out sqlnotebook-${{ github.sha }}.vsix
submodules: true
- uses: cachix/install-nix-action@v16
- run: npm ci
- run: ./compile_sqls.fish
- run: npx vsce package --out sqlnotebook-${{ github.sha }}.vsix
- name: Upload vsix as artifact
uses: actions/upload-artifact@v1
with:
Expand Down
23 changes: 13 additions & 10 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,26 +18,29 @@ permissions:
jobs:
publish:
runs-on: ubuntu-latest
defaults:
run:
shell: nix develop -c bash {0}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
submodules: true
- name: Parse version
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: Install dependencies
run: npm ci
- name: Install vsce
run: npm install -g [email protected]
- name: Package extension
run: vsce package --out sqlnotebook-${{ env.RELEASE_VERSION }}.vsix
- uses: cachix/install-nix-action@v16
- run: npm ci
- run: ./compile_sqls.fish
- run: npx vsce package --out sqlnotebook-${{ env.RELEASE_VERSION }}.vsix
- name: Upload vsix as artifact
uses: actions/upload-artifact@v1
with:
name: sqlnotebook-${{ env.RELEASE_VERSION }}.vsix
path: sqlnotebook-${{ env.RELEASE_VERSION }}.vsix
- name: Publish Extension to Microsoft Marketplace
run: vsce publish --packagePath ./sqlnotebook-${{ env.RELEASE_VERSION }}.vsix
run: npx vsce publish --packagePath ./sqlnotebook-${{ env.RELEASE_VERSION }}.vsix
shell: nix develop -c bash {0}
env:
VSCE_PAT: ${{ secrets.VSCE_CREDENTIALS }}
- name: Install OpenVSX CLI
run: npm install -g ovsx
- name: Publish to OpenVSX
run: npx ovsx publish ./sqlnotebook-${{ env.RELEASE_VERSION }}.vsix -p ${{ secrets.OPEN_VSX_CREDENTIALS }}
shell: nix develop -c bash {0}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
out
node_modules
*.vsix
sqls_bin
sqls
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "sqls"]
path = sqls
url = https://github.com/cmoog/sqls
1 change: 1 addition & 0 deletions .vscodeignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ vsc-extension-quickstart.md
**/*.map
**/*.ts
**/*.tsbuildinfo
sqls
7 changes: 5 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Change Log

## [Unreleased]
## [Unreleased 0.5.0]

- Initial release
- Package `sqls` language server into `vscode-sql-notebook`.
- When running on a compatible arch/os, notebooks will now
benefit from enhacned typed autocomplete and hover information
when connected to a valid database connection.
32 changes: 32 additions & 0 deletions compile_sqls.fish
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/usr/bin/env fish

# This script compiles the ./sqls language server
# into binaries for the most common ARCH/OS combinations.
# Then, we use `upx` to compress the binary to save on
# overall bundle size.
#
# Eventually, these binaries are bundled into the final
# .vsix asset and shipped with the extension. At runtime,
# the extension will check if an available binary exists for
# the given detected ARCH/OS combo. If yes, it will run it as
# a language server to provide enhanced completion support.


set --local arch { arm64, amd64, 386 }
set --local os { linux, darwin, windows }

cd sqls

for a in $arch
for o in $os
if [ "$o" = "darwin" -a "$a" = "386" ]
continue
end
echo "building sqls_"$a"_"$o
set --local binpath "../sqls_bin/sqls_"$a"_"$o
CGO_ENABLED=0 GOOS=$o GOARCH=$a go build -o $binpath -ldflags="-s -w"; or exit 1

# disable this for now, it was causing issues on arm64/darwin
# upx $binpath
end
end
2 changes: 1 addition & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
in
{
devShell = pkgs.mkShell {
packages = with pkgs; [ nodejs-16_x ];
packages = with pkgs; [ nodejs-16_x go_1_17 fish upx ];
};
}
);
Expand Down
Loading