grandma3-tsserver-plugin
v0.3.0
Published
A TypeScript language server plugin that improves the editor experience for grandMA3 plugin development.
Readme
grandMA3 Typescript Server Plugin
A TypeScript language server plugin that improves the editor experience for grandMA3 plugin development.
Why
The grandMA3 Lua API exposes a large number of global functions. Without this plugin, those functions dominate the autocomplete suggestions and push variables, properties, and other non-function entries out of view. They also get mixed with TypeScript/JavaScript built-ins (Array, Promise, Math, …) and language keywords, which are rarely what you want first. This plugin reorders completions so the entries most relevant to grandMA3 scripting surface first.
How it works
The plugin wraps getCompletionsAtPosition and rewrites the sortText of each completion entry to group entries into ranked buckets. It leaves TypeScript's local/current-scope bucket (sortText === "11") untouched and reorganizes the rest.
Member completions
For member access, TypeScript normally lumps everything into one bucket sorted alphabetically, mixing properties and methods. This plugin reorders them as:
- Properties starting with an uppercase character
- Properties starting with a lowercase character
- Methods starting with an uppercase character
- Methods starting with a lowercase character
- All remaining entries
Global / ambient completions
Within TypeScript's ambient-globals bucket (sortText === "15"), entries are ordered:
- Values / properties / modules
- Functions / methods
- Source / auto-import completions (e.g.
socket,lfs,json,ftpnamespace members) - Language keywords (
if,for,class, …) - TypeScript/JavaScript built-in default-lib globals (
Array,Object,Promise,Math,JSON, …)
Built-in default-lib globals are detected by walking the symbols in scope and keeping only those declared exclusively in default library files, so project and grandMA3 globals are preferred over built-ins.
Entry classification
Function-kinded entries:
functionlocal functionmember functionconstructorcall signatureconstruct signature
Value-kinded entries:
property/ member variable- member get/set accessor
var/let/const- local variable
- parameter
module
Usage
The plugin is consumed as a local dependency of the root project and registered in tsconfig.json:
{
"compilerOptions": {
"plugins": [{ "name": "grandma3-tsserver-plugin" }]
}
}It is installed automatically via npm install in the root project.
Build
npm run buildOutput is written to ./dist/.
Formatting
This project uses Prettier.
npm run format # write
npm run format:check # check onlyLicense
Copyright (C) 2026 Lukas Runge Veranstaltungstechnik.
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with this program. If not, see https://www.gnu.org/licenses/.
See COPYING.LESSER and COPYING for the full license texts.
