Compare commits

...
Author SHA1 Message Date
Christoph Brandau bf0f36dc99 feat: regsub variable declaration check 2025-08-19 13:13:17 +02:00
Christoph 54a2e5892b feat: var after global token variable 2025-08-18 19:57:15 +02:00
Christoph 56372ae9ba Update version to 2025.9.101 2025-08-16 17:08:09 +00:00
3 changed files with 16 additions and 1 deletions
+1 -1
View File
@@ -2,7 +2,7 @@
"name": "nx-post-support", "name": "nx-post-support",
"displayName": "NX Postprocessor Support", "displayName": "NX Postprocessor Support",
"description": "", "description": "",
"version": "2025.9.100", "version": "2025.9.101",
"publisher": "Christoph", "publisher": "Christoph",
"icon": "images/nx-1.png", "icon": "images/nx-1.png",
"serverInfo": { "serverInfo": {
+9
View File
@@ -120,6 +120,15 @@ class UndeclaredVariableCheck(Visitor):
base = text.split("(", 1)[0] # Handle array syntax base = text.split("(", 1)[0] # Handle array syntax
if not base.startswith("::"): if not base.startswith("::"):
locals_set.add(base) locals_set.add(base)
elif name == "regsub" and node.args:
# regsub ?switches? exp string subSpec ?varName?
# If a varName is provided as the last arg, treat it as a local
last_arg = node.args[-1]
text = _word_text(last_arg)
if text:
base = text.split("(", 1)[0]
if base and not base.startswith("::"):
locals_set.add(base)
elif name == "foreach" and len(node.args) >= 3: elif name == "foreach" and len(node.args) >= 3:
# foreach varlist1 list1 ?varlist2 list2 ...? body # foreach varlist1 list1 ?varlist2 list2 ...? body
# Treat loop variables as locals within the proc # Treat loop variables as locals within the proc
+6
View File
@@ -108,6 +108,12 @@ class _Highlighter(Visitor):
if name == "global": if name == "global":
line, col = routine.contents_pos line, col = routine.contents_pos
self._tokens.append((((line - 1, col - 1), len(name), "keyword", []))) self._tokens.append((((line - 1, col - 1), len(name), "keyword", [])))
first_arg = command.args[0]
token_info = self._get_token_info(first_arg)
if token_info:
(line, col), length = token_info
mods = [TokenModifier.declaration, TokenModifier.write]
self._tokens.append(((line, col), length, "variable", mods))
if routine.contents == "puts": if routine.contents == "puts":
line, col = routine.contents_pos line, col = routine.contents_pos