-
-
Notifications
You must be signed in to change notification settings - Fork 91
feat: Add lua-language-server to CI #2611
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
fidgetingbits
merged 9 commits into
cursorless-dev:main
from
fidgetingbits:lua-ls-linting
Aug 1, 2024
+91
−6
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
edf5110
feat: Add lua-language-server to pre-commit hooks
fidgetingbits 52d143d
Address feedback
fidgetingbits 65ce01c
address feedback
fidgetingbits d2a85ab
Merge branch 'main' into lua-ls-linting
fidgetingbits 6557aa2
ignore the .lua folder created by CI action
fidgetingbits 63c5e14
Update flake.nix
pokey 654dca7
Trigger CI
fidgetingbits aece96d
test fixing mac tests
fidgetingbits 0fcac0e
revert mac test
fidgetingbits File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| name: "Lua Language Server Lint" | ||
| description: "Lints all lua files with lua-language-server" | ||
| runs: | ||
| using: "composite" | ||
| steps: | ||
| - uses: cachix/install-nix-action@v27 | ||
| with: | ||
| nix_path: nixpkgs=channel:nixos-unstable | ||
| - uses: DeterminateSystems/magic-nix-cache-action@v2 | ||
| - run: nix profile install --accept-flake-config .#lua-language-server | ||
| shell: bash | ||
| - run: scripts/lint-lua-ls.sh | ||
| shell: bash |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| { | ||
| "runtime.version": "Lua 5.1", | ||
| "diagnostics.ignoredFiles": "Disable", | ||
| "diagnostics.globals": ["vim", "talon", "it", "describe"], | ||
| "workspace.ignoreDir": ["data/playground/lua/", ".luarocks", ".lua"] | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| #!/usr/bin/env bash | ||
| set -euo pipefail | ||
|
|
||
| # lua-language-server should be installed automatically by the flake.nix dev shell | ||
| # or .github/workflows/pre-commit.yml | ||
| if ! type lua-language-server &>/dev/null; then | ||
| echo "ERROR: lua-language-server is not installed. Please run 'nix develop' or install it manually." | ||
| exit 1 | ||
| fi | ||
|
|
||
| if [ ! -e "${CURSORLESS_REPO_ROOT-nonexistent}" ]; then | ||
| CURSORLESS_REPO_ROOT=$(git rev-parse --show-toplevel) | ||
| fi | ||
|
|
||
| function check_file() { | ||
| local file="$1" | ||
| logpath="$(mktemp -d)" | ||
| rm -rf "$logpath/check.json" | ||
| result=$(lua-language-server --check "$file" \ | ||
| --checklevel="Warning" \ | ||
| --configpath="${CURSORLESS_REPO_ROOT}/.luarc.json" \ | ||
| --logpath="$logpath") | ||
| if [[ ! "$result" == *"no problems found"* ]]; then | ||
| if [ -e "$logpath/check.json" ]; then | ||
| cat "$logpath/check.json" | ||
| else | ||
| echo "ERROR: lua-language-server failed to run." | ||
| echo "$result" | ||
| fi | ||
| return 1 | ||
|
|
||
| fi | ||
| return 0 | ||
| } | ||
|
|
||
| # lua-language-server doesn't support single file parsing, so check entire folder | ||
| exit_code=0 | ||
| if ! check_file "${CURSORLESS_REPO_ROOT}"; then | ||
| exit_code=1 | ||
| fi | ||
|
|
||
| exit $exit_code | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.