Feat/lsp and ide experience#32
Merged
ulysse-bouchet-simvia merged 9 commits intomainfrom Apr 27, 2026
Merged
Conversation
…atter - Catalog path now resolved from the cave-selected code_aster version: extract `code_aster/Cata/` from the matching Docker image to a per-version cache and inject via `VS_CODE_ASTER_CATA_PATH` so the LSP serves completion / hover / signatures for the version the user actually runs. Falls back to the bundled vendored catalog when Docker/cave are unavailable. - New right-aligned status bar item (`CaveStatusBar`) mirrors VS Code's Python interpreter picker: click to switch, install (with auto-confirmed `y` prompt and progress notification), or remove versions. Reconciles orphan caches on startup and when images are removed. - `HoverManager` rewritten as TypeScript-style Markdown: signature rendered as a python code fence (theme-highlighted), description italic paragraph below, rules list, `Search documentation for …` link. Handles command, keyword, factor marker, allowed-value literal, variable reference, and plain literal assignment hovers. Localized EN/FR via LANG env. - `.comm` grammar rewritten around a `function-call` begin/end block with a nested `parens` sub-block so `_F(...)`, tuples, and multi-line kwargs all color correctly. Lowercase `e` in scientific notation, Python constants (`None/True/False`), and lowercase kwarg names are now supported. - New `CommFormatter` shells out to `python -m ruff format --quote-style=preserve` for `.comm` files. First-open flow probes for ruff and offers a one-click `pip install ruff` with progress; retries with `--user` under PEP 668. - Language aliases: `code_aster (comm)` and `code_aster (export)`. - `examples/lsp_showcase.comm`: demo file exercising every LSP surface.
…ted-factor suggestions Rewrites the completion path around a single forward scan that walks from the enclosing command's start to the cursor, tracking paren depth, string state, factor frames, and per-frame written kwargs. Replaces the previous backward scan, which broke on mid-edit unmatched quotes. Highlights: - Trigger chars expanded to (, ',', =, space; client-side hide-then-trigger re-pops the suggest widget on each so it never sticks in "No suggestions". - Snippet inserts: command → NAME($0) and re-triggers; kwarg → NAME=$0; factor kwarg → NAME=_F($0); value/variable → trailing ", " + retrigger unless it's the last param. - Value position dispatch: shows allowed `into` literals, then variables whose source command's sd_prod is type-compatible (issubclass) with the expected SIMP class — including callable sd_prod resolved by inspecting its signature and passing __all__=True. - Nested _F(...) keyword completion via factor path; written-kwarg filter also works inside factor scopes. - Empty results in value position return is_incomplete=True so VS Code re-queries on the next keystroke. - Registry: on_document_change falls back to a full reparse when the change line isn't in any tracked command, so newly-typed commands register without waiting for a multi-line edit. - Disable editor.wordBasedSuggestions for [comm] so empty LSP results don't get padded with file-word noise. - Showcase example removed; it served its purpose during development.
The LSP channel was previously named "Python Language Server" — misleading since it serves code_aster, not Python. Renamed to "code_aster: Language Server" and aligned the catalog/formatter channels to the same prefix so they group together in VS Code's Output dropdown. LSP error toasts updated accordingly. Internal LanguageClient id is unchanged to preserve any saved user trace settings.
Collapses the install path from 8 manual README steps to "open a .comm or .export file and click yes on the toasts". Setup is opt-in at every step, with persisted "Don't ask again" choices in globalState. Pieces: - PythonEnv: shared probe/install helpers; auto-creates a managed venv in globalStorageUri when the user hasn't picked an interpreter, runs `pip install pygls numpy medcoupling` (PEP-668 fallback), and writes the venv path back to vs-code-aster.pythonExecutablePath. - SetupOnboarding: orchestrates Python deps → ruff → Docker → cave → code_aster image. Cave install runs in an integrated terminal (sudo visible), then polls `which cave` for up to 5 min and chains into the version-install picker on success. Native Windows skips the auto path and opens the cave install instructions instead. - SidebarView: new activity-bar view container with Setup / Quick actions / Versions / Settings groups. Setup auto-collapses when all five probes are green; per-setting icons; clicking a version row runs `cave use` directly, "Install another version…" goes straight to the install picker. Activity-bar icon is the simvia logo recolored to currentColor with a tightened viewBox to remove the original padding. - CommFormatter is constructed with the extension context now and uses the shared Python helpers; the embedded ruff prompt moves into the onboarding chain. - Two new commands: vs-code-aster.runSetup (force the chain) and vs-code-aster.switchCaveVersion / .installCaveVersion (sidebar-only direct entry points).
Surfaces eight categories of issue as VS Code Diagnostics, all sourced from the existing CommandRegistry + CATA introspection: unknown command, unknown keyword, value-not-in-into, missing required keyword, regles violation, undefined variable, variable type mismatch, and a soft information-level note for legacy/boilerplate commands. Quick fixes are offered for the high-confidence cases (fuzzy-match command or keyword name; pick from allowed values). Robustness — every CATA touch is wrapped so a single quirky catalog entry can't crash the LSP or shadow other features. validate() always returns a (possibly empty) list, never raises; the publish helper swallows exceptions and falls back to clearing diagnostics. The extra `---` HR before the doc link in hovers is removed: when VS Code stacks multiple hover contributions (our hover + a diagnostic), the rule was only as wide as our block and looked broken. New: validators.py (shared CATA helpers), diagnostics_manager.py, code_action_manager.py, position-aware parse_keyword_positions on CommandRegistry. Wired into handlers.py with a 200ms debounce on didChange.
Previously each restart constructed a new LanguageClient, which re-registered hover/completion/code-action providers on top of the existing ones — hence duplicate tooltips after every cave use. The intermediate fix (dispose the old client) introduced a different bug: VS Code kept calling the disposed client's code-action provider until its provider list was purged, throwing "Client got disposed and can't be restarted". Solution: keep a single LanguageClient for the extension lifetime and just stop()/start() it on restart. Server-side env (catalog path) is refreshed by mutating the saved serverOptions.options.env in place; LanguageClient re-reads it on each spawn.
Cosmetic feature was opt-in by intent but shipped opt-out. Users who explicitly enabled it keep their preference; users on the original default switch to off on next reload. Updates package.json, the webview-side fallbacks, and the popup's reset target so all four defaults agree.
…links Rework the sidebar into a single home for navigation, browsing, and discovery so the status bar can shed its drilldown. - Command browser: a new collapsible group lists the five canonical command families with the file's commands first (✓) and the rest of the catalog dim. Visible only when a .comm file is active. Search action in the view title bar runs a fuzzy QuickPick over the full catalog. - Quick actions reshape per active editor: New export file / Restart language server / Show catalog info are always there; Run with code_aster only on .export; Open mesh viewer only on .comm and configured MED extensions. Run setup checks moved out (still reachable via the Setup group rows or palette). - External group at the very end, always expanded: Star on GitHub / Rate on Marketplace / Browse code_aster website / Browse code_aster documentation / Visit simvia.tech. The website row uses light/dark variants of the brand mark so it matches the surrounding codicon foreground. - Setup floats: at the top when any probe fails (auto-expanded), at the bottom as `Setup (n/5)` when healthy (collapsed). Status bar now a single icon — neutral when 3+ command families are present in the file, warning-tinted otherwise — that opens and expands the Command browser group on click. The disk-read analyzer in status_bar_manager.py is replaced by a registry walk so unsaved edits are reflected immediately. LspServer fires an `onReady` event on start/restart; the sidebar and status bar listen so their first probe (which lands before the server is up) self-corrects without a file switch.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
[1.10.0] - 2026-04-27
A broad LSP and IDE-experience pass: cave-driven catalog resolution, a TypeScript-style hover layer, context-aware autocompletion, edit-time diagnostics with quick fixes, a
.commformatter, a guided setup flow, and a new activity-bar panel that doubles as a command dictionary. The status bar slims to an icon and Output channels are grouped under a singlecode_aster:prefix.Added
~/.cache/vs-code-aster/catalogs/<version>/and cached). A bundled 16.7 catalog ships as a zero-config fallback, so the editor still works when Docker / cave aren't installed. The selection follows~/.cavelive and an in-memory reconcile clears orphan caches when an image is removed.cave use <v>withypiped in and reports progress through phases (Pulling / Downloading / Extracting / Finalizing). Cancellable..comm/.exportopen walks the user through Python LSP deps (auto-installed into a managed venv at<globalStorage>/.venv), ruff, Docker, cave, and a code_aster image. Each step is opt-in withInstall/Not now/Don't ask again, and the newcode_aster: Run setup checkscommand re-fires the chain.Setup (n/5), top when failing, bottom when healthy), Quick actions (filtered per active editor), Command browser (only when a.commis active), Versions, Settings, External links, and the bottom Setup. The brand mark gets a tightened monochrome icon for the activity bar plus light/dark variants for in-tree use.Cmd+P-style QuickPick over every catalog command. Reads fromCommandRegistryso it updates live without saving.pythoncode fence (signature → description → details → doc link). Required vs optional read as Python defaults, BLOC branches filter by the parameters already typed at the call site,reglesrules render as a bullet list, and the doc link points atdemo-docaster.simvia-app.fr/versions/v17/. Surfaces thetranslation={...}short labels when present and is locale-aware (FR / EN viaLANG). Variants for command, keyword, allowed-value literal, factor marker, plain-Python variable assignment, and legacy-command notes._F(...)scopes, suggests allowedintovalues when the cursor is in a value position, suggests previously-defined variables compatible with the SIMP's expected class (resolves callablesd_prodvia__all__=True), and filters already-typed kwargs at every depth (not just the outer call). Snippet inserts:LIRE_MAILLAGE($0),KEY=$0,KEY=_F($0)— each retriggers the popup. Trigger characters expanded to(,,,=, space; client-side hide-then-trigger keeps the suggest widget from sticking on "No suggestions"..commfiles with quick-fix code actions: unknown command, unknown keyword, value not ininto, missing required keyword,reglesviolations, undefined variable, type mismatch, and a soft information note for legacy commands. Quick fixes offer fuzzy-matched replacements (Levenshtein) and allowed-value swaps. Wrapped end-to-end so a CATA quirk can never block hover, completion, or formatting..commformatter viapython -m ruff format --quote-style=preserve --line-length=100. First-open prompt offers to install ruff with one click into the managed venv; PEP-668 retry with--user..commsyntax grammar overhaul — TextMate rules rewritten around afunction-callbegin/end block with a nestedparenssub-block so_F(...), tuples, and multi-line kwargs all color correctly. Lowercase scientific notation, Python constants (None/True/False), and lowercase kwarg names are now recognized. Single-quote auto-close added;wordPatternkeeps_attached.Changed
$(symbol-namespace)neutral when 3+ command families are present in the file,$(circle-outline)warning-tinted otherwise. Click opens and expands the sidebar's Command browser group.code_aster:prefix —code_aster: Language Server(replaces the misleadingPython Language Server),code_aster: Catalog,code_aster: Formatter. LSP error toasts updated accordingly.code_aster (comm)andcode_aster (export).# …doc strings to keep the signature scannable.Fixed
restart()no longer recreates theLanguageClient, so hover / completion / code-action providers don't duplicate aftercave use. Server env (catalog path) is refreshed by mutatingserverOptions.options.envin place before bouncing.LspServer.onReadyevent to re-probe, so the Command browser populates without a file switch even when the LSP starts after activation.~/.caveselections (image removed viadocker rmi) now correctly fall back to the bundled catalog. The trash button on the version picker also clears the matching extracted-catalog cache..commCommandRegistryfalls back to a full reparse when a single-line edit is outside any tracked command, so newly-typed top-level commands register immediately.pip installfor ruff / LSP deps no longer passes--userunconditionally (broke venv installs); retried with--useronly on PEP-668 errors.