Skip to content

Don't crash on missing configured libraries#50

Merged
AnHeuermann merged 1 commit into
OpenModelica:mainfrom
AnHeuermann:issue/49
Jun 19, 2026
Merged

Don't crash on missing configured libraries#50
AnHeuermann merged 1 commit into
OpenModelica:mainfrom
AnHeuermann:issue/49

Conversation

@AnHeuermann

Copy link
Copy Markdown
Member

Issue

Fixes #49.

Rational

Deleting a Modelica library directory that was still listed in the modelica.libraries setting caused the language server to throw an unhandled error during initialize, failing the LSP handshake and leaving the server in a restart loop.

Changes

Analyzer.loadLibrary now checks that the path exists and contains a package.mo before loading, returning false (with a debug log) instead of throwing when it doesn't. Server initialization wraps each workspace and configured-library load so a single bad entry no longer aborts startup. When a configured library is skipped, the server raises a VS Code warning notification telling the user to fix or remove the entry from the modelica.libraries setting.

Adds regression tests for skipping non-existent library and workspace paths.

Deleting a Modelica library directory that was still listed in the
`modelica.libraries` setting caused the language server to throw an
unhandled error during `initialize`, failing the LSP handshake and
leaving the server in a restart loop.

`Analyzer.loadLibrary` now checks that the path exists and contains a
`package.mo` before loading, returning `false` (with a debug log)
instead of throwing when it doesn't. Server initialization wraps each
workspace and configured-library load so a single bad entry no longer
aborts startup. When a configured library is skipped, the server raises
a VS Code warning notification telling the user to fix or remove the
entry from the `modelica.libraries` setting.

Adds regression tests for skipping non-existent library and workspace
paths.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@AnHeuermann AnHeuermann self-assigned this Jun 19, 2026
@AnHeuermann AnHeuermann enabled auto-merge (squash) June 19, 2026 09:14
@AnHeuermann AnHeuermann merged commit 62ca2dc into OpenModelica:main Jun 19, 2026
3 checks passed
@AnHeuermann AnHeuermann deleted the issue/49 branch June 19, 2026 09:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Deleting Modelica libs crashes server

1 participant