@aehrc/fsh-language-server
v0.8.6
Published
Language support for FHIR Shorthand (FSH) with IntelliSense, validation, and documentation
Readme
FSH Language Server for VS Code
Language support for FHIR Shorthand (FSH) with IntelliSense, validation, and documentation.
This extension uses the FSH Language Server to provide language features.
Features
🎯 IntelliSense & Auto-completion
- FHIR Resources: Auto-complete FHIR resource types (Patient, Observation, etc.)
- Element Paths: Smart completion for resource elements with dot notation
- FSH Keywords: Complete FSH entity types (Profile, Extension, Instance, etc.)
- Context-Aware: Suggestions based on your current position in the file
✅ Validation & Diagnostics
- Real-time Validation: Instant feedback on FSH syntax errors
- FHIR Compliance: Validates against FHIR specifications
- Package Name Validation: Ensures consistent package naming conventions
- Configurable Severity: Adjust error/warning levels to your needs
📖 Documentation on Hover
- Element Information: View FHIR element types, cardinality, and descriptions
- ValueSet Bindings: See bound value sets and their strength
- Quick Links: Direct links to FHIR documentation
- Code System Info: Lookup code definitions from terminology servers
🔍 Navigation
- Go to Definition: Jump to profile, extension, or instance definitions (F12)
- Find References: Find all usages of a definition
- Document Symbols: Outline view of all entities in your file
- Workspace Symbols: Search across all FSH files in your project
🎨 Code Actions & Formatting
- Auto-formatting: Format FSH files with consistent style
- Quick Fixes: Suggested fixes for common issues
- Rename Refactoring: Safely rename entities across files
Getting Started
Install the Extension
- Search for "FSH Language Server" in VS Code Extensions
- Click Install
Open a FSH Project
- Open a folder containing
.fshfiles - The extension activates automatically
- Open a folder containing
Configure Settings (Optional)
- Open Settings (Ctrl+,)
- Search for "FSH"
- Customize to your preferences
Configuration
Validation
{
"fsh.validation.enabled": true,
"fsh.fhirVersion": "4.0.1"
}Hover & IntelliSense
{
"fsh.hover.showElementInfo": true,
"fsh.hover.showDocumentationLinks": true,
"fsh.completion.enabled": true
}Formatting
{
"fsh.format.indentSize": 2,
"fsh.format.maxLineLength": 120,
"fsh.format.alignCaretPaths": false
}Terminology Servers
{
"fsh.terminology.servers": [
"https://tx.fhir.org/r4"
],
"fsh.terminology.enableCache": true
}Package Naming
{
"fsh.packageName.prefix": "au.csiro",
"fsh.packageName.severity": "warning"
}Commands
- FSH: Restart Language Server - Restart the language server
- FSH: Show Output Channel - View language server logs
- FSH: Open Documentation - Open FSH specification
Access commands via Command Palette (Ctrl+Shift+P)
Keyboard Shortcuts
- F12 - Go to Definition
- Shift+F12 - Find References
- F2 - Rename Symbol
- Ctrl+Space - Trigger Completion
- Ctrl+Shift+O - Go to Symbol in File
Troubleshooting
Language Server Not Starting
- Check the Output panel: View → Output → "FSH Language Server"
- Try restarting: Command Palette → "FSH: Restart Language Server"
- Reload VS Code: Command Palette → "Developer: Reload Window"
No Auto-completion
- Ensure
fsh.completion.enabledistrue - Check that your file has
.fshextension - Try triggering manually with Ctrl+Space
Validation Issues
- Verify
fsh.validation.enabledistrue - Check
fsh.fhirVersionmatches your project - Review diagnostics in the Problems panel
Requirements
- VS Code 1.75.0 or higher
- Node.js 16.0.0 or higher (for development)
Development
Setup
- Clone the repository
- Install dependencies:
npm install - Build:
npm run build
Using GitLab NPM Registry
The extension depends on @aehrc/fsh-lsp from the GitLab NPM registry. For local development:
- Create a GitLab personal access token with
read_apiandread_registryscopes - Add to
~/.npmrc:
@aehrc:registry=https://gitlab.com/api/v4/projects/79617133/packages/npm/
//gitlab.com/api/v4/projects/79617133/packages/npm/:_authToken=YOUR_TOKENSupport
- Issues: GitLab Issues
- Core Server: FSH Language Server
- Documentation: FSH Specification
- FHIR: FHIR Documentation
License
Apache-2.0
Credits
Developed by CSIRO's Australian e-Health Research Centre (AEHRC)
