Skip to content
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
6 changes: 6 additions & 0 deletions .github/badges/install-size.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"schemaVersion": 1,
"label": "install size",
"message": "no release yet",
"color": "lightgrey"
}
12 changes: 11 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,14 @@ jobs:
- name: Third-party notices are current
run: npm run notices -- --check
- name: Package VSIX
run: npx vsce package --no-dependencies --changelog-path docs/CHANGELOG.vsix.md --out ie-lua-language-server.vsix
env:
BRANCH: ${{ github.head_ref || github.ref_name }}
run: |
flags=()
# Release branches are packaged exactly as the Release workflow will publish them
# (odd minor = pre-release), so that the install-size check below sees the same bytes.
if [[ "$BRANCH" == release/v* ]] && (( $(cut -d . -f 2 VERSION) % 2 == 1 )); then flags+=(--pre-release); fi
npx vsce package --no-dependencies --changelog-path docs/CHANGELOG.vsix.md "${flags[@]}" --out ie-lua-language-server.vsix
- name: VSIX contents
run: |
npx vsce ls --no-dependencies | tee vsix-files.txt
Expand All @@ -104,6 +111,9 @@ jobs:
printf '::error title=VSIX contents::Unexpected files in the VSIX (update .vscodeignore):\n%s\n' "$unexpected"
exit 1
fi
- name: Install-size badge matches the VSIX (release branches)
if: startsWith(github.head_ref || github.ref_name, 'release/v')
run: node scripts/release/cli.mts install-size --vsix ie-lua-language-server.vsix --check
- name: Upload VSIX
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
Expand Down
37 changes: 30 additions & 7 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,15 @@
# 1. "Run workflow" (choose pre-release or stable) → job `prepare`:
# computes the next version from git tags + Conventional Commits
# (scripts/release/), updates VERSION, package.json, package-lock.json,
# CHANGELOG.md and docs/CHANGELOG.vsix.md, and opens a release pull request.
# CHANGELOG.md and docs/CHANGELOG.vsix.md, packages the VSIX to record its
# installed size for the README badge (.github/badges/install-size.json),
# and opens a release pull request.
# 2. Merging that pull request changes VERSION on main → job `publish`
# (environment `release`): verifies the version, runs the checks, packages the
# VSIX and creates the tag and the GitHub (pre-)release. Other pushes that
# touch VERSION (for example a manual version reset) skip `publish`: it runs
# only for the squash commit of a `chore(release): …` pull request.
# only for the squash commit of a `chore(release): …` pull request. It also
# checks that the committed install-size badge matches the VSIX it publishes.
#
# Version rules (VS Code): plain major.minor.patch; even minor = stable,
# odd minor = pre-release (packaged with `vsce package --pre-release`).
Expand Down Expand Up @@ -60,6 +63,18 @@ jobs:
env:
CHANNEL: ${{ inputs.channel }}
run: node scripts/release/cli.mts prepare --channel "$CHANNEL"
- name: Production bundle
run: npm run package
- name: Record the installed size of the VSIX
env:
VERSION: ${{ steps.version.outputs.version }}
CHANNEL: ${{ steps.version.outputs.channel }}
run: |
flags=()
if [ "$CHANNEL" = "pre-release" ]; then flags+=(--pre-release); fi
vsix="$RUNNER_TEMP/ie-lua-language-server-$VERSION.vsix"
npx vsce package --no-dependencies --changelog-path docs/CHANGELOG.vsix.md "${flags[@]}" --out "$vsix"
node scripts/release/cli.mts install-size --vsix "$vsix" --write
- name: Open release pull request
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -75,7 +90,7 @@ jobs:
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git switch -c "$branch"
git add VERSION package.json package-lock.json CHANGELOG.md docs/CHANGELOG.vsix.md
git add VERSION package.json package-lock.json CHANGELOG.md docs/CHANGELOG.vsix.md .github/badges/install-size.json
git commit -m "chore(release): $TAG"
git push origin "$branch"
gh pr create --base main --head "$branch" --title "chore(release): $TAG" --body \
Expand Down Expand Up @@ -129,9 +144,17 @@ jobs:
run: |
flags=()
if [ "$CHANNEL" = "pre-release" ]; then flags+=(--pre-release); fi
npx vsce package --no-dependencies --changelog-path docs/CHANGELOG.vsix.md "${flags[@]}" \
--out "ie-lua-language-server-$VERSION.vsix"
sha256sum "ie-lua-language-server-$VERSION.vsix" | tee "ie-lua-language-server-$VERSION.vsix.sha256"
vsix="ie-lua-language-server-$VERSION.vsix"
npx vsce package --no-dependencies --changelog-path docs/CHANGELOG.vsix.md "${flags[@]}" --out "$vsix"
# The checksum goes in the release notes, not in a second asset: the VSIX is then the
# only asset, so the downloads badge (all assets of all releases) counts VSIX downloads.
hash="$(sha256sum "$vsix" | cut -d ' ' -f 1)"
echo "SHA-256 of $vsix: $hash"
printf '\n**SHA-256** of `%s`: `%s`\n' "$vsix" "$hash" >> "$RUNNER_TEMP/notes.md"
- name: Install-size badge matches the VSIX
env:
VERSION: ${{ steps.version.outputs.version }}
run: node scripts/release/cli.mts install-size --vsix "ie-lua-language-server-$VERSION.vsix" --check --notes "$RUNNER_TEMP/notes.md"
- name: Create GitHub release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -142,4 +165,4 @@ jobs:
flags=()
if [ "$CHANNEL" = "pre-release" ]; then flags+=(--prerelease); else flags+=(--latest); fi
gh release create "$TAG" --target "$GITHUB_SHA" --title "$TAG" --notes-file "$RUNNER_TEMP/notes.md" "${flags[@]}" \
"ie-lua-language-server-$VERSION.vsix" "ie-lua-language-server-$VERSION.vsix.sha256"
"ie-lua-language-server-$VERSION.vsix"
22 changes: 22 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,21 @@ the extension live in [`docs/CHANGELOG.vsix.md`](docs/CHANGELOG.vsix.md).
comments and runs of `--` lines; in `.menu` files every `{ … }` block, `` `…` `` blocks and
`"…"` scripts, plus the Lua inside them. The closing line stays visible. Honors the client's
`rangeLimit` and supported kinds.
- Go to definition (`textDocument/definition`) within the document: from any use of a local to
its declaration, and from a global to every assignment to it (`x = …`, `function x()`). In
`.menu` files globals are shared by all Lua chunks, locals stay in their own chunk. No result
for the implicit `self`, for globals the document never assigns, or for table fields.
- Find references (`textDocument/references`) within the document, with the same matching as
go to definition: the uses of a local, including the implicit `self` of a method, or every use
of a global across the Lua chunks of the document. `includeDeclaration` decides whether the
local's declaration, or the assignments to the global, are included.
- Rename (`textDocument/prepareRename`, `textDocument/rename`) within the document, for locals
and for globals the document assigns. Refused, with a reason localized in VS Code: anything
that is not a variable, the implicit `self`, globals the document never assigns (defined in
another file, the game or EEex), code with syntax errors where the variable can occur, new names
that are not Lua names or are reserved words, and any rename that would change what a name
refers to (checked by re-analyzing the renamed text). Edits are versioned when the client
supports `documentChanges`.
- Error-tolerant Lua 5.2 parser and scope analysis (`src/server/syntax/`), checked against the
official compiler by a differential test; it publishes no diagnostics of its own.
- Localization of the manifest and UI strings into all 14 VS Code display languages
Expand All @@ -50,5 +65,12 @@ the extension live in [`docs/CHANGELOG.vsix.md`](docs/CHANGELOG.vsix.md).
committed `VERSION` as the first stable release (a pre-release before it would be 1.1.0).
- The Release workflow publishes only for merged `chore(release): …` pull requests, not for any
other push that changes `VERSION`.
- The Release workflow records the installed size of each release for the README's install-size
badge (`.github/badges/install-size.json`, a shields.io endpoint): the size VS Code shows in the
extension's details, computed from the VSIX exactly as VS Code installs it
(`scripts/release/vsix.mts`). CI checks it on release branches and the publish job against the
VSIX it publishes; the exact byte count goes in the release notes.
- GitHub releases have the VSIX as their only asset; its SHA-256 moved from a separate
`.vsix.sha256` file into the release notes, so the download count covers VSIX downloads only.
- CI integration jobs build the tests before running them, and a test run that finds no tests now
fails. Until now the CI integration jobs ran 0 tests and passed.
2 changes: 1 addition & 1 deletion CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
|---|---|
| Name | `IE Lua Language Server` |
| Publisher | `infinity-engine-tools` |
| Purpose | Lua 5.2 language support (diagnostics, document symbols and folding now; more LSP features planned) for Infinity Engine EE `.lua` files and the Lua embedded in `.menu` files, usable from VS Code and other LSP editors |
| Purpose | Lua 5.2 language support (diagnostics, document symbols, folding, and same-file definition, references and rename now; more LSP features planned) for Infinity Engine EE `.lua` files and the Lua embedded in `.menu` files, usable from VS Code and other LSP editors |
| Language | TypeScript (strict) |
| Bundler | esbuild (two bundles: client + language server) |
| Minimum VS Code | `^1.91.0` (see `engines.vscode` in `package.json`; required by `vscode-languageclient` ≥ 10) |
Expand Down
10 changes: 8 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,15 @@ Nothing is ever published to a marketplace (`"private": true`; `vsce publish` is
**stable**. It computes the next version (odd minor for pre-releases, even minor for stable,
always higher than every earlier release; the very first stable release is the committed
`VERSION`, 1.0.0, and a pre-release before it would be 1.1.0), updates `VERSION`, `package.json`, `package-lock.json`
and both changelogs, and opens a `chore(release): vX.Y.Z` pull request.
and both changelogs, records the size VS Code will show for the installed VSIX in
`.github/badges/install-size.json` (the README's install-size badge), and opens a
`chore(release): vX.Y.Z` pull request. CI checks that size on every `release/v*` branch: if `main` moves
and you update the branch, re-run `node scripts/release/cli.mts install-size --vsix <file> --write` on
a VSIX packaged as the error message describes, and commit the file.
3. Review and merge that pull request. The workflow then verifies the version, runs the checks,
packages the VSIX and creates the tag and the GitHub release (environment `release`).
packages the VSIX and creates the tag and the GitHub release (environment `release`). The VSIX
is the release's only asset; its SHA-256 and exact installed size are at the end of the release
notes. Publishing fails if the committed install-size badge does not match the VSIX.

## Repository settings (maintainers)

Expand Down
15 changes: 13 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
[![CI](https://img.shields.io/github/actions/workflow/status/4Luke4/IE-Lua-Language-Server/ci.yml?branch=main&label=CI&logo=github)](https://github.com/4Luke4/IE-Lua-Language-Server/actions/workflows/ci.yml)
[![CodeQL](https://img.shields.io/github/actions/workflow/status/4Luke4/IE-Lua-Language-Server/codeql.yml?branch=main&label=CodeQL&logo=github)](https://github.com/4Luke4/IE-Lua-Language-Server/actions/workflows/codeql.yml)
[![Release](https://img.shields.io/github/v/release/4Luke4/IE-Lua-Language-Server?include_prereleases&sort=semver&label=release)](https://github.com/4Luke4/IE-Lua-Language-Server/releases)
[![Downloads](https://img.shields.io/github/downloads/4Luke4/IE-Lua-Language-Server/total?label=downloads&logo=github)](https://github.com/4Luke4/IE-Lua-Language-Server/releases)
[![Install size](https://img.shields.io/endpoint?url=https%3A%2F%2Fraw.githubusercontent.com%2F4Luke4%2FIE-Lua-Language-Server%2Fmain%2F.github%2Fbadges%2Finstall-size.json)](#installation)
[![License: proprietary](https://img.shields.io/badge/license-proprietary-informational)](LICENSE.md)
[![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-fe5196?logo=conventionalcommits&logoColor=white)](https://www.conventionalcommits.org/en/v1.0.0/)

Expand All @@ -11,8 +13,9 @@ Lua language support for the **Infinity Engine Enhanced Edition** games and the
`.menu` files such as `UI.MENU`.

> [!NOTE]
> This is an early version. It currently provides **syntax diagnostics**, **document symbols**
> and **folding**; completion, hover, navigation, formatting and more are planned.
> This is an early version. It currently provides **syntax diagnostics**, **document symbols**,
> **folding**, **go to definition**, **find references** and **rename** within a file; completion,
> hover, workspace-wide navigation, formatting and more are planned.

## Features

Expand All @@ -27,6 +30,10 @@ Lua language support for the **Infinity Engine Enhanced Edition** games and the
**Go to Symbol in Editor**. Works while the file still has syntax errors.
- **Folding that follows the code:** functions, loops, each `if`/`elseif`/`else` branch, tables,
comments, and every `{ … }` block and Lua script of a `.menu` file.
- **Go to Definition, Find All References and Rename Symbol** for variables within a file. Locals
follow Lua's scoping rules; globals are followed across all the Lua of a `.menu` file. Rename
refuses, and says why, when it could change what the code does: a name already in use nearby,
a reserved word, or a global that is defined outside the file.
- **Available in 14 languages**, following your VS Code display language.
- **Works in other editors** through the Language Server Protocol.

Expand All @@ -44,6 +51,10 @@ This extension is distributed privately as a `.vsix` file.

Requires VS Code **1.91** or later.

The *downloads* badge counts downloads of the `.vsix` files of all releases, as reported by
GitHub; GitHub does not say who downloads, so maintainers' own downloads are included. The
*install size* badge shows the size VS Code reports for the latest release once installed.

## Settings

| Setting | Default | Description |
Expand Down
5 changes: 5 additions & 0 deletions docs/CHANGELOG.vsix.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ versions with an **even** middle number (for example 1.**2**.0) are stable relea
**Go to Symbol in Editor**.
- **Code folding that follows the code.** Fold functions, loops, each branch of an `if`, tables,
comments, and every block and script of a `.menu` file.
- **Go to Definition** jumps from a variable to where it is declared, or to where a global
gets its value in the same file, including across the Lua of a `.menu` file.
- **Find All References** lists every use of a variable in the same file.
- **Rename Symbol** renames a variable everywhere in the file. It refuses, and tells you why,
when the rename could break your code — for example when the new name is already used nearby.
- **Available in 14 languages**, following your VS Code display language.
- **Works in other editors too**: setup guides for Sublime Text, Neovim, Emacs, JetBrains
IDEs, Helix, Zed, Kate, Notepad++ and Geany are on the project page.
7 changes: 6 additions & 1 deletion docs/editors/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,5 +65,10 @@ node /path/to/server.js --stdio
| Syntax errors | `textDocument/publishDiagnostics` | When `validate.mode` says so (see above). |
| Document symbols (outline) | `textDocument/documentSymbol` | Nested when the editor supports it, otherwise a flat list with container names. |
| Folding | `textDocument/foldingRange` | Whole lines; the closing line of each construct stays visible. |
| Go to definition | `textDocument/definition` | The declaration of a local, or every assignment to a global, in the same file. |
| Find references | `textDocument/references` | Every use of a local or global in the same file. |
| Rename | `textDocument/prepareRename`, `textDocument/rename` | Same file only; refused, with the reason as the error message, when the rename could change what the code does. |

Symbols and folding always reflect the current text, whatever `validate.mode` is.
Symbols, folding and navigation always reflect the current text, whatever `validate.mode` is.
Navigation works on variables: table fields (`t.x`) and `goto` labels are not followed, and in a
`.menu` file globals are shared by all its Lua, while locals stay in their own block or script.
7 changes: 7 additions & 0 deletions l10n/bundle.l10n.cs.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
{
"Only the names of local and global variables can be renamed.": "Přejmenovat lze pouze názvy lokálních a globálních proměnných.",
"The implicit \"self\" of a method has no declaration and cannot be renamed.": "Implicitní \"self\" metody nemá deklaraci a nelze jej přejmenovat.",
"This global is never assigned in this file. It is defined elsewhere (another file, the game or EEex), so it cannot be renamed here.": "Tato globální proměnná se v tomto souboru nikdy nepřiřazuje. Je definována jinde (v jiném souboru, ve hře nebo v EEex), proto ji zde nelze přejmenovat.",
"Fix the syntax errors first: names in code that does not parse cannot all be found.": "Nejprve opravte syntaktické chyby: v kódu, který nelze analyzovat, nelze najít všechny názvy.",
"The new name is not a valid Lua name: use letters, digits and underscores, and do not start with a digit.": "Nový název není platný název jazyka Lua: použijte písmena, číslice a podtržítka a nezačínejte číslicí.",
"The new name is a reserved word in Lua.": "Nový název je v jazyce Lua rezervované slovo.",
"Renaming would change what another name in this file refers to.": "Přejmenováním by se změnilo, na co odkazuje jiný název v tomto souboru.",
"Open a Lua or Infinity Engine menu file to validate it.": "Pokud chcete soubor ověřit, otevřete soubor Lua nebo soubor nabídky Infinity Engine.",
"IE Lua: no problems found.": "IE Lua: Nenašly se žádné problémy.",
"IE Lua: {0} problem(s) found.": "IE Lua: Počet nalezených problémů: {0}.",
Expand Down
7 changes: 7 additions & 0 deletions l10n/bundle.l10n.de.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
{
"Only the names of local and global variables can be renamed.": "Nur die Namen lokaler und globaler Variablen können umbenannt werden.",
"The implicit \"self\" of a method has no declaration and cannot be renamed.": "Das implizite \"self\" einer Methode hat keine Deklaration und kann nicht umbenannt werden.",
"This global is never assigned in this file. It is defined elsewhere (another file, the game or EEex), so it cannot be renamed here.": "Diese globale Variable wird in dieser Datei nie zugewiesen. Sie ist an anderer Stelle definiert (in einer anderen Datei, im Spiel oder in EEex) und kann daher hier nicht umbenannt werden.",
"Fix the syntax errors first: names in code that does not parse cannot all be found.": "Beheben Sie zuerst die Syntaxfehler: In Code, der nicht geparst werden kann, lassen sich nicht alle Namen finden.",
"The new name is not a valid Lua name: use letters, digits and underscores, and do not start with a digit.": "Der neue Name ist kein gültiger Lua-Name: Verwenden Sie Buchstaben, Ziffern und Unterstriche, und beginnen Sie nicht mit einer Ziffer.",
"The new name is a reserved word in Lua.": "Der neue Name ist ein reserviertes Wort in Lua.",
"Renaming would change what another name in this file refers to.": "Durch die Umbenennung würde sich ändern, worauf sich ein anderer Name in dieser Datei bezieht.",
"Open a Lua or Infinity Engine menu file to validate it.": "Öffnen Sie eine Lua- oder Infinity Engine-Menüdatei, um sie zu überprüfen.",
"IE Lua: no problems found.": "IE Lua: Keine Probleme gefunden.",
"IE Lua: {0} problem(s) found.": "IE Lua: {0} Problem(e) gefunden.",
Expand Down
Loading
Loading