slim-vscode-tools is a Visual Studio Code extension designed to provide comprehensive support for the SLiM simulation package. This extension includes features such as syntax highlighting, snippets, IntelliSense, and commands to enhance the development experience for SLiM scripts.
Provides syntax highlighting for SLiM scripts using a TextMate grammar. This includes:
- Line and block comments
- Double and single-quoted strings with escape sequences
- Control keywords (
if,else,for,while,function,return,break,continue) - SLiM-specific keywords (
initialize,sim,initializeSLiMOptions, etc.) - Numeric constants
- Language variables (
this,self) - Function definitions and parameters
Shows a tooltip with the function signature and complete documentation from the SLiM help system.
Provides auto-completion for SLiM keywords, functions, and variables, showing a tooltip with the function signature and description.
Provides real-time syntax validation for SLiM scripts:
- Brace matching and block structure validation
- Semicolon checking for statements
- SLiM-specific block structure validation (initialize, early, late, fitness)
- Generation-prefixed block validation (e.g., "1000 late()")
- Function parameter validation
- Smart error reporting with inline diagnostics
- Support for multi-line code blocks
Includes a set of useful snippets to speed up the development process. For example:
initWF: Initializes a basic Wright-Fisher model.initSel: Initializes a model with selection.
Provides basic IntelliSense features such as auto-completion for keywords, functions, and variables.
Full support for .eidos files with appropriate feature filtering:
- Eidos files receive only Eidos-specific completions and documentation
- Dynamic status bar shows "Run Eidos" or "Run SLiM" based on active file
Adds a custom view in the activity bar with a command to run SLiM or Eidos scripts:
- Run SLiM: Executes the currently open SLiM script using the SLiM interpreter.
- Run Eidos: Executes the currently open Eidos script using the Eidos interpreter.
Offers a tree view to the sidebar that shows the full hierarchy of classes, methods, properties, etc.,
as presented in the native SLiMgui help system.
The documentation pages are displayed in a hierarchical, tree view format, where opening
subsequent tabs shows the documentation for the selected item.
Clicking on individual items in the tree view such as methods or properties opens the corresponding
section of the slim documentation in a webview.
Adds a status bar button to quickly run the SLiM script in the active editor. Also adds a command to run the SLiM script in Activity Bar.
- Visual Studio Code version 1.96.0 or higher
- SLiM interpreter installed and accessible in your system's PATH or configured in the extension settings
- Open VS Code
- Go to Extensions View by pressing Ctrl+Shift+X (Windows/Linux) or Cmd+Shift+X (Mac)
- Search for "slim-tools"
- Click Install
- Clone the repository
- Run
npm installto install the dependencies - Run
npm run packageto package the extension - Install the resulting package with
code --install-extension slim-vscode-tools-<current-version-number>-.vsix(this assumes you've installed thevscodecommand line tool)
- Download the latest
.vsixfile from the GitHub releases - Install via command line:
code --install-extension slim-vscode-tools-<version>.vsix - Or install from within VS Code: Extensions View → More Actions (⋮) → "Install from VSIX..."
This extension contributes the following settings:
slimTools.slimInterpreterPath: Path to the SLiM interpreter (e.g.,/usr/local/bin/slimorC:\\Users\\YourName\\slim.exe).slimTools.formatting.tabSize: Number of spaces per indentation level (default: 4).slimTools.formatting.insertSpaces: Use spaces instead of tabs (default: true).slimTools.formatting.maxConsecutiveBlankLines: Maximum consecutive blank lines (default: 2).
The extension provides real-time diagnostic feedback for:
- Syntax errors (mismatched braces, missing semicolons)
- SLiM-specific block structure issues
- Function parameter validation
- Code style recommendations
Diagnostics are displayed as:
- đź”´ Errors: Critical issues that need to be fixed
- 🟡 Warnings: Potential issues or style recommendations
- None at the moment. Please report any issues on the GitHub repository.
Added new features:
- Real-time syntax checking and validation
- SLiM-specific block structure validation
- Enhanced error reporting with inline diagnostics
- Support for generation-prefixed blocks
Initial release of slim-tools with the following features:
- Syntax highlighting for SLiM scripts
- Snippets for common SLiM patterns
- Basic IntelliSense support
- Custom view and command to run SLiM scripts
- Status bar integration
- Full, auto-parsed SLiM documentation now appears in an object-oriented aware way
- Hover / autocomplete for Classes, their properties and methods, etc.
- Documentation Tree view now shows the full hierarchy of classes, methods, properties, etc.
- Clicking on document item in the tree view opens the corresponding section of the slim documentation in a webview
- Improvements in semicolon handling to be more C++ like
- This is only a number bump to include a better icon on the marketplace
- Added GH action to auto-publish the extension to the marketplace
- altered the repo location in the package.json to point to the new location in the slim-community organization
- Added better handling of semicolons in the editor
- Updated documentation to SLiM v5.1
- Improved language configuration (indentation rules, folding, etc.)
- Updated link in README
- Added test simulations (and moved the existing one) into
/test-sims - Remove unused files
- Refactor the language server and extension from JavaScript to TypeScript
- Boilerplate for Vitest testing system
- Small updates to syntax (slim.tmLanguage.json)
- ESLint/Prettier installed for the project
- Update .gitignore
- Fixed build configuration to compile to ./out
- Fixed documentation paths
- Refactor: Increase modularity of language server providers and utils for future expansion
server/src/- All language server codeserver/src/config/- Constants and types shared across the language serverserver/src/handlers/- LSP handler setupserver/src/providers/- Individual language server feature providers (completion, hover, etc.)server/src/services/- Documentation loading and validation servicesserver/src/utils/- General utilities (instance tracking, position helpers)server/src/validation/- Structure validation scripts
- Eidos file support: Full language server support for
.eidosfiles with appropriate feature filtering- Added language configuration for
.eidosfile extension inpackage.json - Eidos files only receive Eidos-specific completions, hover info, and documentation
- Added language configuration for
- Performance improvements: Document caching system to reduce redundant parsing
- Enhanced type inference: Comprehensive type resolution for variables, constants, and expressions
file-type.ts: Determines file type (.eidosvs.slim) and filters features accordinglylogger.ts: Connection-aware logging system with fallback to console loggingdocument-cache.ts: Version-aware caching system for parsed document statetext-processing.ts: HTML entity decoding (usinghelibrary - resolves issue #6), type name cleaning, and signature formattingmarkdown.ts: Centralized markdown generation for hover tooltips and completion documentationtype-manager.ts: Type inference engine for expressions, variables, and SLiM-specific patterns (e.g.,p1,m1)hover-resolvers.ts: Modular hover resolution logic separated from provider code
completion-service.ts: Refactored completion logic into dedicated service class- Supports context-aware completions for methods, properties, functions, callbacks, and types
- Integrates with type inference for better suggestions
documentation-service.ts: Turned documentation retrieval and management into a service- Loads operator documentation from
eidos_operators.json - Improved error handling and logging
- Loads operator documentation from
- Tracks pseudo-parameters (e.g.,
mut,individual,subpop) within callback scopes - Detects model type (WF vs nonWF) from
initializeSLiMModelType() - Tracks defined constants, mutation types, genomic element types, interaction types, subpopulations, species, and script blocks
- Properly handles multiple active documents without race conditions
- Initializes
DocumentationServiceandCompletionServiceinstances - Creates
LanguageServerContextobject for passing shared state - Registers document cache cleanup on document close
- Refactored to use
hover-resolvers.tsfor cleaner separation of concerns
- Status bar now dynamically shows "Run Eidos" or "Run SLiM" based on active file
- Added
test.eidos: Lotka-Volterra predator-prey dynamics simulator (pure Eidos implementation) - Added unit tests for language server providers in
server/src/test
- Go to Definition (
definitions.ts): Jump to the definition of variables, functions, constants, and SLiM objects - Code Actions (Quick Fixes) (
code-actions.ts): Automated fixes for common syntax errors (missing semicolons, unmatched braces, etc.) - Formatting (
formatting.ts): Configurable document formatting for full documents or ranges - Find All References (
references.ts): Locate all usages of variables, functions, and SLiM objects - Folding Ranges (
folding-range.ts): Collapse code blocks for better navigation - Inlay Hints (
inlay-hints.ts): Inline type and parameter information
diagnostics.ts: Centralized diagnostic creation utilities for consistent error reportingvalidation-utils.ts: Helper utilities for getting character ranges for validation diagnosticseidos-function-parser.ts: Parser for Eidos function signatures and parameter extractionvector-detector.ts: Singleton/vector type discrimination and conversion utilities for Eidos type systemranges.ts: Block range finding and comment range detection utilities for folding and navigation
- Integrated with document caching system for significant performance improvement in large files
- Modular validation pipeline with clear extension points
- Prepared infrastructure for future validation modules
- Complete rewrite with enhanced error detection
- Multi-line string tracking with proper escape sequence handling
- Improved brace, bracket, and parenthesis balance tracking
- Better detection of unclosed constructs
- Implemented configurable LRU (Least Recently Used) eviction policy
- Separate caching for tracking state and diagnostics
- New test suites
- Comprehensive unit test suites for all providers
- Existing unit tests expanded for new functionality and edge cases
- New integration tests for testing array access, instance tracking, and tracking order
- Improved
signature-help.tsandcompletion-service.tswith new features/utils - Fixed user-defined function handling to use the correct Eidos syntax
- Added user-defined functions to tracking for hover info, completion, and signature help
- Improve hover info behavior for class members
- Improve completion to avoid document cache race conditions
- Differentiate between mutations and mutation types across all providers
- Fixed subpopulation definition patterns to handle multispecies models
- Improved multi-line string handling in validation
- Removed
--passWithNoTestsflag from language server test script (tests now required to pass)
- First install the dependencies with
npm install - Build the project with
npm run compile - If you want to clean up and remove the compiled files, run
npm run clean - To build the
.vsixfile, runnpm run package - To run the extension in development mode, press
F5to open a new VS Code window with the extension loaded.
Enjoy!




