Skip to content
| Marketplace
Sign in
Visual Studio Code>Programming Languages>painless-lspNew to Visual Studio Code? Get it now.
painless-lsp

painless-lsp

yokoc1322

|
113 installs
| (0) | Free
painless language server
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

painless-lsp

Language server for Elasticsearch's Painless scripting language.

This recognizes files with the .painless extension as Painless script files.

Supported Architectures

  • x86_64-pc-windows-msvc
  • x86_64-unknown-linux-gnu
  • aarch64-apple-darwin

Features

  • Syntax highlight
    • Semantic tokens (full) only

Planned for future implementation

  • Goto definition
  • Find reference
  • Hover
  • Diagnostic
  • Rename
  • Signature Help
  • Semantic Token (full_delta)
  • Semantic Token (range)

TODO

Notice

This Language server has the following issues. These problems occurred during the process of porting the parser from Elasticsearch to Rust. We plan to address these issues in the future.

  • dangling else
  • (probably) confusing the slash used for division with the slash used in regular expressions

For Development

How to initialize

How to Update Parser Code Based on Elasticsearch Definitions

Due to the constraints of the library used to utilize ANTLR definitions in Rust, some features need to be disabled or fixed.

  1. Copy the contents from https://github.com/elastic/elasticsearch/tree/main/modules/lang-painless/src/main/antlr to assets/antlr/
  2. Rewrite the section that uses _input.LA(1) to a format that does not use _input.LA(1).
  3. Run make build_antlr
  4. For the generated painlessparser.rs:
    1. Rename type to type_
    2. Add #![allow(unused_parens)]
    3. Rename PainlessParserParserContext to PainlessParserContext
  5. For the generated painlesslexer.rs:
    1. Modify fn isShashRegex to always return false

How to Publish

  1. make build_release
  2. (For local debugging, run code --install-extension dist/painless-lsp-x.y.z.vsix)
  3. Upload dist/painless-lsp-x.y.z.vsix file manually
    • WEB UI or command

References

  • LSP
    • Language Server Protocol
    • VS Code Language Server Extension Guide
  • LSP sample
    • rust-analyzer
    • haskell/lsp
  • LSP libraries
    • lsp_types
    • tower-lsp
  • VSCode extension -Publishing Extensions
  • painless
    • Painless Language Specification
  • antlr4rust
    • https://github.com/rrevenantt/antlr4rust

Note

This repository is based on https://github.com/IWANABETHATGUY/tower-lsp-boilerplate. And this is licensed under AGPLv3 as it includes parts of Elasticsearch code. (painless ANTLR parser)

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft