aboutsummaryrefslogtreecommitdiffstats
path: root/testsuite/pyunit
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2022-06-26 07:07:42 +0200
committerTristan Gingold <tgingold@free.fr>2022-06-26 07:07:42 +0200
commit73c3617f8e6ca9ef251ed1c4471c68608d70b827 (patch)
tree74ea104e62566a5275a34e1d38bd743836d09e21 /testsuite/pyunit
parent8b78193d828d191e07a0535711d25cb6eb23c30c (diff)
downloadghdl-73c3617f8e6ca9ef251ed1c4471c68608d70b827.tar.gz
ghdl-73c3617f8e6ca9ef251ed1c4471c68608d70b827.tar.bz2
ghdl-73c3617f8e6ca9ef251ed1c4471c68608d70b827.zip
testsuite/pyunit/lsp: add a test for removing diags on close
Diffstat (limited to 'testsuite/pyunit')
-rw-r--r--testsuite/pyunit/lsp/011closediag/adder.vhdl20
-rw-r--r--testsuite/pyunit/lsp/011closediag/cmds.json443
-rw-r--r--testsuite/pyunit/lsp/011closediag/replies.json98
-rw-r--r--testsuite/pyunit/lsp/LanguageServer.py6
4 files changed, 567 insertions, 0 deletions
diff --git a/testsuite/pyunit/lsp/011closediag/adder.vhdl b/testsuite/pyunit/lsp/011closediag/adder.vhdl
new file mode 100644
index 000000000..7d5b62c97
--- /dev/null
+++ b/testsuite/pyunit/lsp/011closediag/adder.vhdl
@@ -0,0 +1,20 @@
+ library ieee;
+ use ieee.std_logic_1164.all;
+
+ entity adder is
+ port(
+ a : in std_logic;
+ b : in std_logic;
+ o : out std_logic;
+ c : out std_logic
+ );
+ end entity;
+
+ architecture comb of adder is
+ signal nouse : boolean;
+ begin
+
+ o <= a xor b;
+ c <= a and b;
+
+ end;
diff --git a/testsuite/pyunit/lsp/011closediag/cmds.json b/testsuite/pyunit/lsp/011closediag/cmds.json
new file mode 100644
index 000000000..95980b7ee
--- /dev/null
+++ b/testsuite/pyunit/lsp/011closediag/cmds.json
@@ -0,0 +1,443 @@
+[
+ {
+ "jsonrpc": "2.0",
+ "id": 0,
+ "method": "initialize",
+ "params": {
+ "processId": 10037,
+ "clientInfo": {
+ "name": "Visual Studio Code",
+ "version": "1.68.1"
+ },
+ "locale": "en-us",
+ "rootPath": "@ROOT@/011closediag",
+ "rootUri": "file://@ROOT@/011closediag",
+ "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@/011closediag",
+ "name": "011closediag"
+ }
+ ]
+ }
+ },
+ {
+ "jsonrpc": "2.0",
+ "method": "initialized",
+ "params": {}
+ },
+ {
+ "jsonrpc": "2.0",
+ "method": "textDocument/didOpen",
+ "params": {
+ "textDocument": {
+ "uri": "file://@ROOT@/011closediag/adder.vhdl",
+ "languageId": "vhdl",
+ "version": 1,
+ "text": " library ieee;\n use ieee.std_logic_1164.all;\n \n entity adder is\n port(\n a : in std_logic;\n b : in std_logic;\n o : out std_logic;\n c : out std_logic\n );\n end entity;\n \n architecture comb of adder is\n signal nouse : boolean;\n begin\n \n o <= a xor b;\n c <= a and b;\n \n end;\n"
+ }
+ }
+ },
+ {
+ "jsonrpc": "2.0",
+ "id": 1,
+ "method": "textDocument/documentSymbol",
+ "params": {
+ "textDocument": {
+ "uri": "file://@ROOT@/011closediag/adder.vhdl"
+ }
+ }
+ },
+ {
+ "jsonrpc": "2.0",
+ "method": "textDocument/didClose",
+ "params": {
+ "textDocument": {
+ "uri": "file://@ROOT@/011closediag/adder.vhdl"
+ }
+ }
+ }
+]
diff --git a/testsuite/pyunit/lsp/011closediag/replies.json b/testsuite/pyunit/lsp/011closediag/replies.json
new file mode 100644
index 000000000..4f119fad5
--- /dev/null
+++ b/testsuite/pyunit/lsp/011closediag/replies.json
@@ -0,0 +1,98 @@
+[
+ {
+ "jsonrpc": "2.0",
+ "id": 0,
+ "result": {
+ "capabilities": {
+ "textDocumentSync": {
+ "openClose": true,
+ "change": 2,
+ "save": {
+ "includeText": true
+ }
+ },
+ "hoverProvider": false,
+ "definitionProvider": 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@/011closediag/adder.vhdl",
+ "diagnostics": [
+ {
+ "source": "ghdl",
+ "range": {
+ "start": {
+ "line": 13,
+ "character": 11
+ },
+ "end": {
+ "line": 13,
+ "character": 11
+ }
+ },
+ "message": "signal \"nouse\" is never referenced",
+ "severity": 2
+ }
+ ]
+ }
+ },
+ {
+ "jsonrpc": "2.0",
+ "id": 1,
+ "result": [
+ {
+ "kind": 2,
+ "name": "adder",
+ "location": {
+ "uri": "file://@ROOT@/011closediag/adder.vhdl",
+ "range": {
+ "start": {
+ "line": 3,
+ "character": 2
+ },
+ "end": {
+ "line": 10,
+ "character": 2
+ }
+ }
+ }
+ },
+ {
+ "kind": 2,
+ "name": "comb",
+ "location": {
+ "uri": "file://@ROOT@/011closediag/adder.vhdl",
+ "range": {
+ "start": {
+ "line": 12,
+ "character": 2
+ },
+ "end": {
+ "line": 19,
+ "character": 1
+ }
+ }
+ }
+ }
+ ]
+ },
+ {
+ "jsonrpc": "2.0",
+ "method": "textDocument/publishDiagnostics",
+ "params": {
+ "uri": "file://@ROOT@/011closediag/adder.vhdl",
+ "diagnostics": []
+ }
+ }
+]
diff --git a/testsuite/pyunit/lsp/LanguageServer.py b/testsuite/pyunit/lsp/LanguageServer.py
index 417c128c9..79c891868 100644
--- a/testsuite/pyunit/lsp/LanguageServer.py
+++ b/testsuite/pyunit/lsp/LanguageServer.py
@@ -235,3 +235,9 @@ class Test010_ls_28(JSONTest):
def test_Request_Response(self):
self._RequestResponse("cmds.json", "replies.json")
+
+class Test011_closediag(JSONTest):
+ subdir = Path("011closediag")
+
+ def test_Request_Response(self):
+ self._RequestResponse("cmds.json", "replies.json")