aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2023-04-24 19:41:55 +0200
committerTristan Gingold <tgingold@free.fr>2023-04-24 19:41:55 +0200
commit3f1cd8b2da5a3e033ab985879a744741ad97e28f (patch)
treee0106b2ab11872afd3895b018ba368e141dc1b19
parentf27fa74f758572bfe367967a37fd515598042093 (diff)
downloadghdl-3f1cd8b2da5a3e033ab985879a744741ad97e28f.tar.gz
ghdl-3f1cd8b2da5a3e033ab985879a744741ad97e28f.tar.bz2
ghdl-3f1cd8b2da5a3e033ab985879a744741ad97e28f.zip
testsuite/pyunit/lsp: add a test for libraries
-rw-r--r--testsuite/pyunit/lsp/012library/cmds.json450
-rw-r--r--testsuite/pyunit/lsp/012library/ent1.vhdl9
-rw-r--r--testsuite/pyunit/lsp/012library/hdl-prj.json6
-rw-r--r--testsuite/pyunit/lsp/012library/pkg1.vhdl3
-rw-r--r--testsuite/pyunit/lsp/012library/replies.json56
-rw-r--r--testsuite/pyunit/lsp/LanguageServer.py6
6 files changed, 530 insertions, 0 deletions
diff --git a/testsuite/pyunit/lsp/012library/cmds.json b/testsuite/pyunit/lsp/012library/cmds.json
new file mode 100644
index 000000000..eb5d8d64b
--- /dev/null
+++ b/testsuite/pyunit/lsp/012library/cmds.json
@@ -0,0 +1,450 @@
+[
+ {
+ "jsonrpc": "2.0",
+ "id": 0,
+ "method": "initialize",
+ "params": {
+ "processId": 30811,
+ "clientInfo": {
+ "name": "Visual Studio Code",
+ "version": "1.77.3"
+ },
+ "locale": "en-us",
+ "rootPath": "@ROOT@/012library",
+ "rootUri": "file://@ROOT@/012library",
+ "capabilities": {
+ "workspace": {
+ "applyEdit": true,
+ "workspaceEdit": {
+ "documentChanges": true,
+ "resourceOperations": [
+ "create",
+ "rename",
+ "delete"
+ ],
+ "failureHandling": "textOnlyTransactional",
+ "normalizesLineEndings": true,
+ "changeAnnotationSupport": {
+ "groupsOnLabel": true
+ }
+ },
+ "didChangeConfiguration": {
+ "dynamicRegistration": true
+ },
+ "didChangeWatchedFiles": {
+ "dynamicRegistration": true
+ },
+ "symbol": {
+ "dynamicRegistration": true,
+ "symbolKind": {
+ "valueSet": [
+ 1,
+ 2,
+ 3,
+ 4,
+ 5,
+ 6,
+ 7,
+ 8,
+ 9,
+ 10,
+ 11,
+ 12,
+ 13,
+ 14,
+ 15,
+ 16,
+ 17,
+ 18,
+ 19,
+ 20,
+ 21,
+ 22,
+ 23,
+ 24,
+ 25,
+ 26
+ ]
+ },
+ "tagSupport": {
+ "valueSet": [
+ 1
+ ]
+ }
+ },
+ "codeLens": {
+ "refreshSupport": true
+ },
+ "executeCommand": {
+ "dynamicRegistration": true
+ },
+ "configuration": true,
+ "workspaceFolders": true,
+ "semanticTokens": {
+ "refreshSupport": true
+ },
+ "fileOperations": {
+ "dynamicRegistration": true,
+ "didCreate": true,
+ "didRename": true,
+ "didDelete": true,
+ "willCreate": true,
+ "willRename": true,
+ "willDelete": true
+ }
+ },
+ "textDocument": {
+ "publishDiagnostics": {
+ "relatedInformation": true,
+ "versionSupport": false,
+ "tagSupport": {
+ "valueSet": [
+ 1,
+ 2
+ ]
+ },
+ "codeDescriptionSupport": true,
+ "dataSupport": true
+ },
+ "synchronization": {
+ "dynamicRegistration": true,
+ "willSave": true,
+ "willSaveWaitUntil": true,
+ "didSave": true
+ },
+ "completion": {
+ "dynamicRegistration": true,
+ "contextSupport": true,
+ "completionItem": {
+ "snippetSupport": true,
+ "commitCharactersSupport": true,
+ "documentationFormat": [
+ "markdown",
+ "plaintext"
+ ],
+ "deprecatedSupport": true,
+ "preselectSupport": true,
+ "tagSupport": {
+ "valueSet": [
+ 1
+ ]
+ },
+ "insertReplaceSupport": true,
+ "resolveSupport": {
+ "properties": [
+ "documentation",
+ "detail",
+ "additionalTextEdits"
+ ]
+ },
+ "insertTextModeSupport": {
+ "valueSet": [
+ 1,
+ 2
+ ]
+ }
+ },
+ "completionItemKind": {
+ "valueSet": [
+ 1,
+ 2,
+ 3,
+ 4,
+ 5,
+ 6,
+ 7,
+ 8,
+ 9,
+ 10,
+ 11,
+ 12,
+ 13,
+ 14,
+ 15,
+ 16,
+ 17,
+ 18,
+ 19,
+ 20,
+ 21,
+ 22,
+ 23,
+ 24,
+ 25
+ ]
+ }
+ },
+ "hover": {
+ "dynamicRegistration": true,
+ "contentFormat": [
+ "markdown",
+ "plaintext"
+ ]
+ },
+ "signatureHelp": {
+ "dynamicRegistration": true,
+ "signatureInformation": {
+ "documentationFormat": [
+ "markdown",
+ "plaintext"
+ ],
+ "parameterInformation": {
+ "labelOffsetSupport": true
+ },
+ "activeParameterSupport": true
+ },
+ "contextSupport": true
+ },
+ "definition": {
+ "dynamicRegistration": true,
+ "linkSupport": true
+ },
+ "references": {
+ "dynamicRegistration": true
+ },
+ "documentHighlight": {
+ "dynamicRegistration": true
+ },
+ "documentSymbol": {
+ "dynamicRegistration": true,
+ "symbolKind": {
+ "valueSet": [
+ 1,
+ 2,
+ 3,
+ 4,
+ 5,
+ 6,
+ 7,
+ 8,
+ 9,
+ 10,
+ 11,
+ 12,
+ 13,
+ 14,
+ 15,
+ 16,
+ 17,
+ 18,
+ 19,
+ 20,
+ 21,
+ 22,
+ 23,
+ 24,
+ 25,
+ 26
+ ]
+ },
+ "hierarchicalDocumentSymbolSupport": true,
+ "tagSupport": {
+ "valueSet": [
+ 1
+ ]
+ },
+ "labelSupport": true
+ },
+ "codeAction": {
+ "dynamicRegistration": true,
+ "isPreferredSupport": true,
+ "disabledSupport": true,
+ "dataSupport": true,
+ "resolveSupport": {
+ "properties": [
+ "edit"
+ ]
+ },
+ "codeActionLiteralSupport": {
+ "codeActionKind": {
+ "valueSet": [
+ "",
+ "quickfix",
+ "refactor",
+ "refactor.extract",
+ "refactor.inline",
+ "refactor.rewrite",
+ "source",
+ "source.organizeImports"
+ ]
+ }
+ },
+ "honorsChangeAnnotations": false
+ },
+ "codeLens": {
+ "dynamicRegistration": true
+ },
+ "formatting": {
+ "dynamicRegistration": true
+ },
+ "rangeFormatting": {
+ "dynamicRegistration": true
+ },
+ "onTypeFormatting": {
+ "dynamicRegistration": true
+ },
+ "rename": {
+ "dynamicRegistration": true,
+ "prepareSupport": true,
+ "prepareSupportDefaultBehavior": 1,
+ "honorsChangeAnnotations": true
+ },
+ "documentLink": {
+ "dynamicRegistration": true,
+ "tooltipSupport": true
+ },
+ "typeDefinition": {
+ "dynamicRegistration": true,
+ "linkSupport": true
+ },
+ "implementation": {
+ "dynamicRegistration": true,
+ "linkSupport": true
+ },
+ "colorProvider": {
+ "dynamicRegistration": true
+ },
+ "foldingRange": {
+ "dynamicRegistration": true,
+ "rangeLimit": 5000,
+ "lineFoldingOnly": true
+ },
+ "declaration": {
+ "dynamicRegistration": true,
+ "linkSupport": true
+ },
+ "selectionRange": {
+ "dynamicRegistration": true
+ },
+ "callHierarchy": {
+ "dynamicRegistration": true
+ },
+ "semanticTokens": {
+ "dynamicRegistration": true,
+ "tokenTypes": [
+ "namespace",
+ "type",
+ "class",
+ "enum",
+ "interface",
+ "struct",
+ "typeParameter",
+ "parameter",
+ "variable",
+ "property",
+ "enumMember",
+ "event",
+ "function",
+ "method",
+ "macro",
+ "keyword",
+ "modifier",
+ "comment",
+ "string",
+ "number",
+ "regexp",
+ "operator"
+ ],
+ "tokenModifiers": [
+ "declaration",
+ "definition",
+ "readonly",
+ "static",
+ "deprecated",
+ "abstract",
+ "async",
+ "modification",
+ "documentation",
+ "defaultLibrary"
+ ],
+ "formats": [
+ "relative"
+ ],
+ "requests": {
+ "range": true,
+ "full": {
+ "delta": true
+ }
+ },
+ "multilineTokenSupport": false,
+ "overlappingTokenSupport": false
+ },
+ "linkedEditingRange": {
+ "dynamicRegistration": true
+ }
+ },
+ "window": {
+ "showMessage": {
+ "messageActionItem": {
+ "additionalPropertiesSupport": true
+ }
+ },
+ "showDocument": {
+ "support": true
+ },
+ "workDoneProgress": true
+ },
+ "general": {
+ "regularExpressions": {
+ "engine": "ECMAScript",
+ "version": "ES2020"
+ },
+ "markdown": {
+ "parser": "marked",
+ "version": "1.1.0"
+ }
+ }
+ },
+ "trace": "off",
+ "workspaceFolders": [
+ {
+ "uri": "file://@ROOT@/012library",
+ "name": "012library"
+ }
+ ]
+ }
+ },
+ {
+ "jsonrpc": "2.0",
+ "method": "initialized",
+ "params": {}
+ },
+ {
+ "jsonrpc": "2.0",
+ "method": "textDocument/didOpen",
+ "params": {
+ "textDocument": {
+ "uri": "file://@ROOT@/012library/ent1.vhdl",
+ "languageId": "vhdl",
+ "version": 1,
+ "text": "entity ent1 is\nend;\n\nlibrary lib1;\nuse lib1.pkg1.all;\narchitecture behav of ent1 is\nbegin\n assert c = 12 severity failure;\nend;\n"
+ }
+ }
+ },
+ {
+ "jsonrpc": "2.0",
+ "method": "textDocument/didClose",
+ "params": {
+ "textDocument": {
+ "uri": "file://@ROOT@/012library/ent1.vhdl"
+ }
+ }
+ },
+ {
+ "jsonrpc": "2.0",
+ "method": "textDocument/didOpen",
+ "params": {
+ "textDocument": {
+ "uri": "file://@ROOT@/012library/pkg1.vhdl",
+ "languageId": "vhdl",
+ "version": 1,
+ "text": "package pkg1 is\n constant c : natural := 12;\nend;\n"
+ }
+ }
+ },
+ {
+ "jsonrpc": "2.0",
+ "id": 3,
+ "method": "shutdown"
+ }
+]
diff --git a/testsuite/pyunit/lsp/012library/ent1.vhdl b/testsuite/pyunit/lsp/012library/ent1.vhdl
new file mode 100644
index 000000000..f47f6efcd
--- /dev/null
+++ b/testsuite/pyunit/lsp/012library/ent1.vhdl
@@ -0,0 +1,9 @@
+entity ent1 is
+end;
+
+library lib1;
+use lib1.pkg1.all;
+architecture behav of ent1 is
+begin
+ assert c = 12 severity failure;
+end;
diff --git a/testsuite/pyunit/lsp/012library/hdl-prj.json b/testsuite/pyunit/lsp/012library/hdl-prj.json
new file mode 100644
index 000000000..6e2112b24
--- /dev/null
+++ b/testsuite/pyunit/lsp/012library/hdl-prj.json
@@ -0,0 +1,6 @@
+{
+ "files" : [
+ { "file" : "pkg1.vhdl", "language" : "vhdl", "library" : "lib1" },
+ { "file" : "ent1.vhdl", "language" : "vhdl" }
+ ]
+}
diff --git a/testsuite/pyunit/lsp/012library/pkg1.vhdl b/testsuite/pyunit/lsp/012library/pkg1.vhdl
new file mode 100644
index 000000000..0179f2a7b
--- /dev/null
+++ b/testsuite/pyunit/lsp/012library/pkg1.vhdl
@@ -0,0 +1,3 @@
+package pkg1 is
+ constant c : natural := 12;
+end;
diff --git a/testsuite/pyunit/lsp/012library/replies.json b/testsuite/pyunit/lsp/012library/replies.json
new file mode 100644
index 000000000..4a5cfbc76
--- /dev/null
+++ b/testsuite/pyunit/lsp/012library/replies.json
@@ -0,0 +1,56 @@
+[
+ {
+ "jsonrpc": "2.0",
+ "id": 0,
+ "result": {
+ "capabilities": {
+ "textDocumentSync": {
+ "openClose": true,
+ "change": 2,
+ "save": {
+ "includeText": true
+ }
+ },
+ "hoverProvider": true,
+ "definitionProvider": true,
+ "implementationProvider": true,
+ "referencesProvider": false,
+ "documentHighlightProvider": false,
+ "documentSymbolProvider": true,
+ "codeActionProvider": false,
+ "documentFormattingProvider": false,
+ "documentRangeFormattingProvider": true,
+ "renameProvider": false
+ }
+ }
+ },
+ {
+ "jsonrpc": "2.0",
+ "method": "textDocument/publishDiagnostics",
+ "params": {
+ "uri": "file://@ROOT@/012library/ent1.vhdl",
+ "diagnostics": []
+ }
+ },
+ {
+ "jsonrpc": "2.0",
+ "method": "textDocument/publishDiagnostics",
+ "params": {
+ "uri": "file://@ROOT@/012library/ent1.vhdl",
+ "diagnostics": []
+ }
+ },
+ {
+ "jsonrpc": "2.0",
+ "method": "textDocument/publishDiagnostics",
+ "params": {
+ "uri": "file://@ROOT@/012library/pkg1.vhdl",
+ "diagnostics": []
+ }
+ },
+ {
+ "jsonrpc": "2.0",
+ "id": 3,
+ "result": null
+ }
+]
diff --git a/testsuite/pyunit/lsp/LanguageServer.py b/testsuite/pyunit/lsp/LanguageServer.py
index 326b92b7b..f3a1d65fc 100644
--- a/testsuite/pyunit/lsp/LanguageServer.py
+++ b/testsuite/pyunit/lsp/LanguageServer.py
@@ -241,3 +241,9 @@ class Test011_closediag(JSONTest):
def test_Request_Response(self):
self._RequestResponse("cmds.json", "replies.json")
+
+class Test012_library(JSONTest):
+ subdir = Path("012library")
+
+ def test_Request_Response(self):
+ self._RequestResponse("cmds.json", "replies.json")