diff --git a/CHANGELOG.md b/CHANGELOG.md index 45aa238..228a367 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,22 @@ All notable changes to the **VS Code Aster** extension will be documented in thi The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [1.10.1] - 2026-04-28 + +A round of LSP polish: completion no longer auto-opens on top-level newlines or sticks on "No suggestions", and edit-time diagnostics stop crying wolf on macros that take `CO("name")` outputs or commands whose keywords live behind a `BLOC` gate. + +### Added + +- `DEBUT` autocompletion now inserts a paired `FIN()` block with the cursor parked between them. +- Hovering a `CO("name")`-declared variable shows which macro will produce it and on what line, matching the regular variable hover. + +### Fixed + +- Suggest widget no longer auto-opens on a brand-new top-level line, no longer latches on accepted snippet bodies, and still pops parameter suggestions on Enter inside a function call. +- `CO("name")` inside a macro is recognised as a future-output declaration, so later references to `name` no longer flag as undefined. +- `ASSE_ELEM_SSD` and similar commands no longer report `SOUS_STRUC` / `LIAISON` missing when the keyword's value contains another call (`MODELE=CO(...)`). +- `CALC_MODES` keywords gated by `BLOC(condition=...)` on defaulted catalog values are no longer reported as unknown. + ## [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 `.comm` formatter, 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 single `code_aster:` prefix. diff --git a/CITATION.cff b/CITATION.cff index 94cbb12..f1d8788 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -1,4 +1,4 @@ -cff-version: 1.10.0 +cff-version: 1.10.1 title: VS Code Aster message: >- If you use this software, please cite it using the diff --git a/README.md b/README.md index aed1d12..3e933e2 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@

-
+
diff --git a/ROADMAP.md b/ROADMAP.md
index 7db88dc..472677c 100644
--- a/ROADMAP.md
+++ b/ROADMAP.md
@@ -4,7 +4,7 @@
The extension aims to reduce friction between modeling, validation, execution, and analysis by bringing **code_aster** native workflows into the editor.
-## Current Capabilities (v1.10.0)
+## Current Capabilities (v1.10.1)
- `.export` file generator
- 3D mesh viewer
diff --git a/package-lock.json b/package-lock.json
index dfe04fb..afbb530 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "vs-code-aster",
- "version": "1.10.0",
+ "version": "1.10.1",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "vs-code-aster",
- "version": "1.10.0",
+ "version": "1.10.1",
"license": "GPL-3.0",
"dependencies": {
"@kitware/vtk.js": "^35.10.0",
diff --git a/package.json b/package.json
index aa58fcd..1868d41 100644
--- a/package.json
+++ b/package.json
@@ -1,7 +1,7 @@
{
"name": "vs-code-aster",
"displayName": "VS Code Aster",
- "version": "1.10.0",
+ "version": "1.10.1",
"description": "VS Code extension for code_aster",
"publisher": "simvia",
"license": "GPL-3.0",
diff --git a/python/lsp/command_registry.py b/python/lsp/command_registry.py
index 3116880..ef20233 100644
--- a/python/lsp/command_registry.py
+++ b/python/lsp/command_registry.py
@@ -673,12 +673,6 @@ def _find_command_end(self, lines: list[str], start_idx: int, start_char_pos: in
line = lines[i]
line_clean = self._remove_inline_comment(line)
- # Check for new command
- if i > start_idx:
- new_cmd = self._find_command_start(line)
- if new_cmd is not None:
- return {"end_line": i, "complete": False}
-
in_string = False
string_char = None
diff --git a/python/lsp/handlers.py b/python/lsp/handlers.py
index 83547cd..a7eb08f 100644
--- a/python/lsp/handlers.py
+++ b/python/lsp/handlers.py
@@ -74,7 +74,7 @@ def on_initialize(ls: LanguageServer, params: InitializeParams):
"textDocumentSync": 1,
"completionProvider": {
"resolveProvider": False,
- "triggerCharacters": ["(", ",", "=", " "],
+ "triggerCharacters": ["(", ",", "="],
},
"hoverProvider": True,
"definitionProvider": True,
diff --git a/python/lsp/managers/completion_manager.py b/python/lsp/managers/completion_manager.py
index ed103a5..f7725ec 100644
--- a/python/lsp/managers/completion_manager.py
+++ b/python/lsp/managers/completion_manager.py
@@ -139,13 +139,19 @@ def _completion(self, doc_uri: str, position) -> CompletionList:
def _suggest_commands(self) -> CompletionList:
items = []
for cmd in self.core.get_CATA_commands():
+ if cmd["name"] == "DEBUT":
+ insert = "DEBUT()\n$0\nFIN()"
+ retrigger = None
+ else:
+ insert = cmd["name"] + "($0)"
+ retrigger = _retrigger_command()
items.append(
CompletionItem(
label=cmd["name"],
kind=CompletionItemKind.Function,
- insert_text=cmd["name"] + "($0)",
+ insert_text=insert,
insert_text_format=InsertTextFormat.Snippet,
- command=_retrigger_command(),
+ command=retrigger,
documentation=_md(cmd.get("doc", "")),
)
)
diff --git a/python/lsp/managers/diagnostics_manager.py b/python/lsp/managers/diagnostics_manager.py
index 03af45b..4800e1a 100644
--- a/python/lsp/managers/diagnostics_manager.py
+++ b/python/lsp/managers/diagnostics_manager.py
@@ -26,6 +26,7 @@
find_param,
is_bare_identifier,
required_keywords,
+ simp_defaults,
types_compatible,
value_in_into,
visible_keywords,
@@ -98,6 +99,19 @@ def _validate(self, doc_uri: str) -> list[Diagnostic]:
var_index[ci.var_name] = (ci.start_line, ci.name)
except Exception:
continue
+ # `CO("name")` inside a macro declares a future output bound
+ # to `name`. Register those so later references resolve.
+ try:
+ end = ci.end_line if ci.end_line is not None else ci.zone_end
+ start_idx = max(0, ci.start_line - 1)
+ end_idx = min(len(doc.lines), end)
+ body = "\n".join(doc.lines[start_idx:end_idx])
+ for m in re.finditer(r"\bCO\s*\(\s*['\"]([A-Za-z_]\w*)['\"]", body):
+ name = m.group(1)
+ if name not in var_index:
+ var_index[name] = (ci.start_line, ci.name)
+ except Exception:
+ pass
for ci in registry.commands.values():
try:
@@ -139,11 +153,14 @@ def _validate_command(
except Exception:
pairs = []
- context = {}
try:
- context = ci.parsed_params.copy()
+ context = simp_defaults(cmd_obj.definition)
except Exception:
context = {}
+ try:
+ context.update(ci.parsed_params or {})
+ except Exception:
+ pass
try:
cmd_def_params = self.core.get_command_def(ci.name).get("params", [])
diff --git a/python/lsp/managers/hover_manager.py b/python/lsp/managers/hover_manager.py
index 78a03e2..dd80aeb 100644
--- a/python/lsp/managers/hover_manager.py
+++ b/python/lsp/managers/hover_manager.py
@@ -64,6 +64,10 @@ def _lang() -> str:
"en": "Assigned by `{cmd}` at line {line}",
"fr": "Assigné par `{cmd}` à la ligne {line}",
},
+ "declared_by_co": {
+ "en": "Declared via `CO(...)` inside `{cmd}` at line {line}",
+ "fr": "Déclaré via `CO(...)` dans `{cmd}` à la ligne {line}",
+ },
"assigned_at_line": {
"en": "Assigned at line {line}",
"fr": "Assigné à la ligne {line}",
@@ -205,6 +209,12 @@ def display(self, doc_uri, position):
if assignment is not None:
return _hover(_render_variable_reference(word, assignment, cata))
+ # `CO("name")` inside a macro body declares `name` as a future
+ # output. Treat it like a regular assignment for hover purposes.
+ co_info = _nearest_co_declaration(registry, doc.lines, word, position.line + 1)
+ if co_info is not None:
+ return _hover(_render_variable_reference(word, co_info, cata, via_co=True))
+
# (1b) Plain Python assignments (e.g. `TempRef = 20.0`) aren't
# tracked by CommandRegistry. Scan the doc for the nearest preceding
# line-level `WORD =