@aehrc/fsh-lsp
v0.8.6
Published
Language Server Protocol implementation for FHIR Shorthand (FSH) with syntax highlighting, auto-completion, and HL7 FHIR resource documentation
Readme
FSH Language Server
A Language Server Protocol (LSP) implementation for FHIR Shorthand (FSH), providing intelligent code editing features for healthcare interoperability development.
Editor Integrations
The FSH Language Server can be used with any LSP-compatible editor:
- VSCode Extension - Full-featured extension for Visual Studio Code
- Eclipse Plugin - LSP4E integration for Eclipse IDE
- Vim Integration - coc.nvim extension for Vim/Neovim
- Emacs Integration - lsp-mode configuration for Emacs
Each integration is maintained in a separate repository with its own release cycle.
Features
- Syntax Highlighting: Full syntax highlighting for FHIR Shorthand (FSH) files
- Go to Definition: Navigate to profile, extension, and instance definitions
- Path Expression Completion: Intelligent completion for nested FHIR element paths with dot notation (e.g.,
participant.showsindividual,type, etc.) - Auto-completion: Intelligent completion for FHIR resources, elements, and FSH keywords
- Hover Documentation: Show FHIR element types, cardinality, code definitions, and ValueSet bindings
- Inlay Hints: Display type information inline for assignments
- Document Symbols: Outline view showing profiles, extensions, instances, and value sets
- FHIR Type Resolution: Resolves FHIR resource types and element paths
- Code System Integration: Lookup code definitions from FHIR terminology servers
- Choice Type Expansion: Automatically expands choice types (e.g.,
value[x]→valueString,valueQuantity, etc.)
Installation
Install the language server:
npm install -g @aehrc/fsh-lspThen install the integration for your editor (see Editor Integrations above).
Development
# Install dependencies
cd packages/language-server
npm install
# Build
npm run build
# Watch mode (continuous rebuild)
npm run build:watch
# Run tests
npm test📖 Full Development Guide — Building, testing, and debugging
Quick Links
- Development Guide - Building, running, and debugging
- Architecture - Technical documentation
- Contributing - How to contribute
Requirements
- Node.js v16 or later
- VSCode or compatible LSP client
Links
- GitLab Repository: https://gitlab.com/australian-e-health-research-centre/fsh-lsp
- Issue Tracker: https://gitlab.com/australian-e-health-research-centre/fsh-lsp/-/issues
- FHIR Shorthand Specification: https://build.fhir.org/ig/HL7/fhir-shorthand/
- Sushi (FSH Compiler): https://fshschool.org/docs/sushi/
Architecture
See ARCHITECTURE.md for detailed architecture documentation.
Key components:
FshDefinitionProvider: Go-to-definition functionalityFshCompletionProvider: Intelligent autocompleteFshHoverProvider: Documentation on hoverFshSymbolProvider: Document outline/symbolsFshInlayHintsProvider: Type hints for assignmentsFhirTypeResolver: FHIR resource and element type resolutionFhirDefinitionsLoader: Loads FHIR definitions from packages
Testing
Comprehensive test suite covering all providers:
- Definition provider tests
- Completion provider tests
- Hover provider tests
- Symbol provider tests
- Utility function tests
Run tests with: npm test
License
Apache-2.0
Contributing
We welcome contributions! Please see CONTRIBUTING.md for details on how to get started.
Code of Conduct
This project adheres to a Code of Conduct. By participating, you are expected to uphold this code.
Acknowledgements
Developed by CSIRO's Australian e-Health Research Centre (AEHRC).

