Skip to main content
Glass provides comprehensive TypeScript and JavaScript support through language server integration, offering intelligent completions, type checking, and extensive test framework automation.

LSP Servers

Glass supports multiple TypeScript language servers:
The default language server, providing:
  • TypeScript and JavaScript support
  • JSX/TSX with React support
  • Automatic TypeScript version detection
  • Integration with project’s node_modules/typescript
Installed automatically from npm:
  • Package: typescript-language-server
  • Requires: typescript package

Installation

Features

Intelligent Completions

Glass provides rich completions with syntax highlighting:
const arr = [1, 2, 3];
arr.| // Shows methods with types
Completion displays:
  • map (callbackfn: ...) => U[]
  • filter (predicate: ...) => T[]
  • reduce (callbackfn: ...) => U
With proper syntax highlighting for functions and types.

TypeScript SDK Detection

Glass automatically detects TypeScript installations:
Detects Yarn’s SDK setup:
yarn dlx @yarnpkg/sdks vscode
Glass finds TypeScript at: .yarn/sdks/typescript/lib

Inlay Hints

TypeScript language server provides inlay hints for:
function greet(name: string, age: number) {
  return `Hello ${name}, you are ${age} years old`;
}

greet("Alice", 30);
//    ↑name   ↑age  // Parameter name hints

const result = getValue();
//    ↑: string      // Type hints
Configuration:
{
  "lsp": {
    "typescript-language-server": {
      "initialization_options": {
        "preferences": {
          "includeInlayParameterNameHints": "all",
          "includeInlayVariableTypeHints": true,
          "includeInlayFunctionLikeReturnTypeHints": true
        }
      }
    }
  }
}

Test Framework Integration

Glass automatically detects and provides tasks for popular test frameworks:

Jest

Run all tests in a file:
npm exec -- jest --runInBand file.test.ts
Automatically uses the package manager detected (npm/yarn/pnpm).

Vitest

npm exec -- vitest run --no-file-parallelism file.test.ts

Mocha

# File tests
npm exec -- mocha file.test.js

# Specific test
npm exec -- mocha --grep "test name" file.test.js

Jasmine

# File tests
npm exec -- jasmine file.test.js

# Specific test
npm exec -- jasmine --filter="test name" file.test.js

Bun Test

For projects using Bun:
# File tests
bun test file.test.ts

# Specific test
bun test --test-name-pattern "test name" file.test.ts

Node.js Built-in Test Runner

For Node.js 18+ with native test runner:
# File tests
node --test file.test.js

# Specific test
node --test --test-name-pattern "test name" file.test.js

Package Manager Detection

Glass automatically detects your package manager:
  1. package.json packageManager field:
    {
      "packageManager": "[email protected]"
    }
    
  2. Lock files:
    • pnpm-lock.yaml → pnpm
    • yarn.lock → yarn
    • Default to npm

Package.json Scripts

Glass automatically creates tasks from your package.json scripts:
{
  "scripts": {
    "dev": "next dev",
    "build": "next build",
    "test": "jest",
    "lint": "eslint ."
  }
}
All scripts appear in the task picker:
  • “package.json > dev”
  • “package.json > build”
  • “package.json > test”
  • “package.json > lint”
For monorepos with multiple package.json files, Glass disambiguates by showing the parent directory: "frontend/package.json > dev"

Task Variables

VariableDescriptionExample
TYPESCRIPT_RUNNERDetected package managerpnpm
TYPESCRIPT_JEST_TEST_NAMESanitized test name for Jestmy\\_test
TYPESCRIPT_VITEST_TEST_NAMESanitized test name for Vitestmy\\_test
TYPESCRIPT_BUN_TEST_NAMESanitized test name for Bunmy\\_test
TYPESCRIPT_JEST_PACKAGE_PATHPath to package with Jest/project/packages/app
TYPESCRIPT_MOCHA_PACKAGE_PATHPath to package with Mocha/project
TYPESCRIPT_VITEST_PACKAGE_PATHPath to package with Vitest/project

Test Name Sanitization

Test names with special characters are automatically escaped:
// Test with parameters
test('handles %s and %d', () => {});
// Becomes: handles (.+?) and (.+?)

test('validates $param', () => {});
// Becomes: validates (.+?)
This regex matching allows Jest/Vitest to find parameterized tests.

Configuration

Workspace Configuration

{
  "lsp": {
    "typescript-language-server": {
      "initialization_options": {
        "preferences": {
          "includeInlayParameterNameHints": "all",
          "includeInlayFunctionLikeReturnTypeHints": true,
          "includeInlayVariableTypeHints": true
        },
        "tsserver": {
          "path": ".yarn/sdks/typescript/lib"  // Custom TypeScript path
        }
      }
    }
  }
}

Code Actions

Glass supports these TypeScript code actions:
  • quickfix: Quick fixes for errors
  • refactor: Extract function, constant, etc.
  • refactor.extract: Specific extraction refactorings
  • source: Organize imports, remove unused imports

Complete Function Calls

Enable automatic parameter completion:
{
  "lsp": {
    "typescript-language-server": {
      "settings": {
        "completions": {
          "completeFunctionCalls": true
        }
      }
    }
  }
}
When enabled:
console.log|  // Completes to: console.log(cursor)
array.map|    // Completes to: array.map(cursor => )

File Associations

Glass maps these language IDs:
Glass LanguageLSP Language ID
TypeScripttypescript
JavaScriptjavascript
TSXtypescriptreact

Troubleshooting

For monorepos, ensure your tsconfig.json references are properly set up:
{
  "references": [
    { "path": "./packages/app" },
    { "path": "./packages/lib" }
  ]
}
This allows the TypeScript language server to understand your project structure.
Check Node.js version:
node --version
# Should be v16 or higher
Verify installation:
ls ~/.local/share/zed/languages/typescript-language-server/node_modules
Force reinstall:
  • Remove the directory above
  • Restart Glass

Next Steps

  • Configure ESLint and Prettier via language server settings
  • Set up Tailwind CSS through language extensions
  • Configure multi-folder workspaces for monorepo support

Build docs developers (and LLMs) love