Skip to content

Commit 3df22dd

Browse files
committed
feat: Enable importing and completion of .rest, .rsrc and .json resource extensions (not parsing)
1 parent c2b156b commit 3df22dd

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

packages/language_server/src/robotcode/language_server/robotframework/diagnostics/imports_manager.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,11 @@
8080
from .namespace import Namespace
8181

8282

83-
RESOURCE_EXTENSIONS = (".resource", ".robot", ".txt", ".tsv", ".rst", ".rest")
83+
RESOURCE_EXTENSIONS = (
84+
{".resource", ".robot", ".txt", ".tsv", ".rst", ".rest", ".json", ".rsrc"}
85+
if get_robot_version() >= (6, 1)
86+
else {".resource", ".robot", ".txt", ".tsv", ".rst", ".rest"}
87+
)
8488
REST_EXTENSIONS = (".rst", ".rest")
8589

8690

packages/language_server/src/robotcode/language_server/robotframework/diagnostics/library_doc.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,18 @@
9292

9393
ROBOT_FILE_EXTENSION = ".robot"
9494
RESOURCE_FILE_EXTENSION = ".resource"
95+
REST_EXTENSIONS = {".rst", ".rest"}
96+
JSON_EXTENSIONS = {".json", ".rsrc"}
9597

96-
ALLOWED_RESOURCE_FILE_EXTENSIONS = [ROBOT_FILE_EXTENSION, RESOURCE_FILE_EXTENSION]
97-
ALLOWED_VARIABLES_FILE_EXTENSIONS = [".py", ".yml", ".yaml"]
98+
ALLOWED_RESOURCE_FILE_EXTENSIONS = (
99+
{ROBOT_FILE_EXTENSION, RESOURCE_FILE_EXTENSION, *REST_EXTENSIONS, *JSON_EXTENSIONS}
100+
if get_robot_version() >= (6, 1)
101+
else {ROBOT_FILE_EXTENSION, RESOURCE_FILE_EXTENSION, *REST_EXTENSIONS}
102+
)
103+
104+
ALLOWED_VARIABLES_FILE_EXTENSIONS = (
105+
{".py", ".yml", ".yaml", ".json"} if get_robot_version() >= (6, 1) else {".py", ".yml", ".yaml"}
106+
)
98107
ROBOT_DOC_FORMAT = "ROBOT"
99108
REST_DOC_FORMAT = "REST"
100109

0 commit comments

Comments
 (0)