aboutsummaryrefslogtreecommitdiffstats
path: root/testsuite/pyunit
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/pyunit')
-rw-r--r--testsuite/pyunit/lsp/009ls122/cmds.json446
-rw-r--r--testsuite/pyunit/lsp/009ls122/replies.json158
-rw-r--r--testsuite/pyunit/lsp/010ls28/adder.vhdl20
-rw-r--r--testsuite/pyunit/lsp/010ls28/cmds.json470
-rw-r--r--testsuite/pyunit/lsp/010ls28/hdl-prj.json6
-rw-r--r--testsuite/pyunit/lsp/010ls28/replies.json190
-rw-r--r--testsuite/pyunit/lsp/010ls28/top.vhdl22
-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.py18
-rw-r--r--testsuite/pyunit/lsp/README45
12 files changed, 1936 insertions, 0 deletions
diff --git a/testsuite/pyunit/lsp/009ls122/cmds.json b/testsuite/pyunit/lsp/009ls122/cmds.json
new file mode 100644
index 000000000..c92df94a4
--- /dev/null
+++ b/testsuite/pyunit/lsp/009ls122/cmds.json
@@ -0,0 +1,446 @@
+[
+ {
+ "jsonrpc": "2.0",
+ "id": 0,
+ "method": "initialize",
+ "params": {
+ "processId": 65370,
+ "clientInfo": {
+ "name": "Visual Studio Code",
+ "version": "1.68.1"
+ },
+ "locale": "en-us",
+ "rootPath": "@ROOT@",
+ "rootUri": "file://@ROOT@/",
+ "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@/",
+ "name": "sanity"
+ }
+ ]
+ }
+ },
+ {
+ "jsonrpc": "2.0",
+ "method": "initialized",
+ "params": {}
+ },
+ {
+ "jsonrpc": "2.0",
+ "method": "textDocument/didOpen",
+ "params": {
+ "textDocument": {
+ "uri": "file://@ROOT@/000hello/hello.vhdl",
+ "languageId": "vhdl",
+ "version": 1,
+ "text": "entity hello is\nend hello;\n\narchitecture behav of hello is\nbegin\n assert false report \"Hello VHDL world\" severity note; \u00e9\nend behav;\n"
+ }
+ }
+ },
+ {
+ "jsonrpc": "2.0",
+ "method": "$/setTrace",
+ "params": {
+ "value": "off"
+ }
+ },
+ {
+ "jsonrpc": "2.0",
+ "id": 1,
+ "method": "textDocument/documentSymbol",
+ "params": {
+ "textDocument": {
+ "uri": "file://@ROOT@/000hello/hello.vhdl"
+ }
+ }
+ },
+ {
+ "jsonrpc": "2.0",
+ "id": 2,
+ "method": "shutdown"
+ }
+]
diff --git a/testsuite/pyunit/lsp/009ls122/replies.json b/testsuite/pyunit/lsp/009ls122/replies.json
new file mode 100644
index 000000000..66c1cda26
--- /dev/null
+++ b/testsuite/pyunit/lsp/009ls122/replies.json
@@ -0,0 +1,158 @@
+[
+ {
+ "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@/000hello/hello.vhdl",
+ "diagnostics": [
+ {
+ "source": "ghdl",
+ "range": {
+ "start": {
+ "line": 6,
+ "character": 0
+ },
+ "end": {
+ "line": 6,
+ "character": 0
+ }
+ },
+ "message": "'<=' is expected instead of 'end'",
+ "severity": 1
+ },
+ {
+ "source": "ghdl",
+ "range": {
+ "start": {
+ "line": 6,
+ "character": 0
+ },
+ "end": {
+ "line": 6,
+ "character": 0
+ }
+ },
+ "message": "primary expression expected",
+ "severity": 1
+ },
+ {
+ "source": "ghdl",
+ "range": {
+ "start": {
+ "line": 5,
+ "character": 57
+ },
+ "end": {
+ "line": 5,
+ "character": 57
+ }
+ },
+ "message": "';' expected at end of signal assignment",
+ "severity": 1,
+ "relatedInformation": [
+ {
+ "location": {
+ "uri": "file://@ROOT@/000hello/hello.vhdl",
+ "range": {
+ "start": {
+ "line": 5,
+ "character": 57
+ },
+ "end": {
+ "line": 5,
+ "character": 57
+ }
+ }
+ },
+ "message": "(found: 'end')"
+ }
+ ]
+ },
+ {
+ "source": "ghdl",
+ "range": {
+ "start": {
+ "line": 5,
+ "character": 56
+ },
+ "end": {
+ "line": 5,
+ "character": 56
+ }
+ },
+ "message": "no declaration for \"\u00e9\"",
+ "severity": 1
+ }
+ ]
+ }
+ },
+ {
+ "jsonrpc": "2.0",
+ "id": 1,
+ "result": [
+ {
+ "kind": 2,
+ "name": "hello",
+ "location": {
+ "uri": "file://@ROOT@/000hello/hello.vhdl",
+ "range": {
+ "start": {
+ "line": 0,
+ "character": 0
+ },
+ "end": {
+ "line": 1,
+ "character": 0
+ }
+ }
+ }
+ },
+ {
+ "kind": 2,
+ "name": "behav",
+ "location": {
+ "uri": "file://@ROOT@/000hello/hello.vhdl",
+ "range": {
+ "start": {
+ "line": 3,
+ "character": 0
+ },
+ "end": {
+ "line": 6,
+ "character": 0
+ }
+ }
+ }
+ }
+ ]
+ },
+ {
+ "jsonrpc": "2.0",
+ "id": 2,
+ "result": null
+ }
+]
diff --git a/testsuite/pyunit/lsp/010ls28/adder.vhdl b/testsuite/pyunit/lsp/010ls28/adder.vhdl
new file mode 100644
index 000000000..2b4e6d887
--- /dev/null
+++ b/testsuite/pyunit/lsp/010ls28/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
+
+ begin
+
+ o <= a xor b;
+ c <= a and b;
+
+ end;
diff --git a/testsuite/pyunit/lsp/010ls28/cmds.json b/testsuite/pyunit/lsp/010ls28/cmds.json
new file mode 100644
index 000000000..24ed0543b
--- /dev/null
+++ b/testsuite/pyunit/lsp/010ls28/cmds.json
@@ -0,0 +1,470 @@
+[
+ {
+ "jsonrpc": "2.0",
+ "id": 0,
+ "method": "initialize",
+ "params": {
+ "processId": 6311,
+ "clientInfo": {
+ "name": "Visual Studio Code",
+ "version": "1.68.1"
+ },
+ "locale": "en-us",
+ "rootPath": "@ROOT@/010ls28",
+ "rootUri": "file://@ROOT@/010ls28",
+ "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@/010ls28",
+ "name": "010ls28"
+ }
+ ]
+ }
+ },
+ {
+ "jsonrpc": "2.0",
+ "method": "initialized",
+ "params": {}
+ },
+ {
+ "jsonrpc": "2.0",
+ "method": "textDocument/didOpen",
+ "params": {
+ "textDocument": {
+ "uri": "file://@ROOT@/top.vhdl",
+ "languageId": "vhdl",
+ "version": 1,
+ "text": "library ieee;\nuse ieee.std_logic_1164.all;\n\nentity top is\n port (\n clk : in std_logic;\n sum : out std_logic\n );\nend entity;\n\narchitecture rtl of top is\nbegin\n\n adder : entity work.adder(comb)\n port map(\n a => clk,\n b => '1',\n o => sum,\n c => open\n );\n\nend architecture;\n"
+ }
+ }
+ },
+ {
+ "jsonrpc": "2.0",
+ "id": 1,
+ "method": "textDocument/documentSymbol",
+ "params": {
+ "textDocument": {
+ "uri": "file://@ROOT@/top.vhdl"
+ }
+ }
+ },
+ {
+ "jsonrpc": "2.0",
+ "method": "textDocument/didChange",
+ "params": {
+ "textDocument": {
+ "uri": "file://@ROOT@/top.vhdl",
+ "version": 2
+ },
+ "contentChanges": [
+ {
+ "range": {
+ "start": {
+ "line": 18,
+ "character": 13
+ },
+ "end": {
+ "line": 18,
+ "character": 13
+ }
+ },
+ "rangeLength": 0,
+ "text": " "
+ }
+ ]
+ }
+ },
+ {
+ "jsonrpc": "2.0",
+ "id": 2,
+ "method": "textDocument/documentSymbol",
+ "params": {
+ "textDocument": {
+ "uri": "file://@ROOT@/top.vhdl"
+ }
+ }
+ }
+]
diff --git a/testsuite/pyunit/lsp/010ls28/hdl-prj.json b/testsuite/pyunit/lsp/010ls28/hdl-prj.json
new file mode 100644
index 000000000..51d4f6cf5
--- /dev/null
+++ b/testsuite/pyunit/lsp/010ls28/hdl-prj.json
@@ -0,0 +1,6 @@
+{
+ "files" : [
+ { "file" : "adder.vhdl", "language" : "vhdl" },
+ { "file" : "top.vhdl", "language" : "vhdl" }
+ ]
+ }
diff --git a/testsuite/pyunit/lsp/010ls28/replies.json b/testsuite/pyunit/lsp/010ls28/replies.json
new file mode 100644
index 000000000..f67600637
--- /dev/null
+++ b/testsuite/pyunit/lsp/010ls28/replies.json
@@ -0,0 +1,190 @@
+[
+ {
+ "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@/top.vhdl",
+ "diagnostics": []
+ }
+ },
+ {
+ "jsonrpc": "2.0",
+ "id": 1,
+ "result": [
+ {
+ "kind": 2,
+ "name": "top",
+ "location": {
+ "uri": "file://@ROOT@/top.vhdl",
+ "range": {
+ "start": {
+ "line": 3,
+ "character": 0
+ },
+ "end": {
+ "line": 8,
+ "character": 0
+ }
+ }
+ }
+ },
+ {
+ "kind": 2,
+ "name": "rtl",
+ "location": {
+ "uri": "file://@ROOT@/top.vhdl",
+ "range": {
+ "start": {
+ "line": 10,
+ "character": 0
+ },
+ "end": {
+ "line": 21,
+ "character": 0
+ }
+ }
+ }
+ },
+ {
+ "kind": 6,
+ "name": "adder",
+ "location": {
+ "uri": "file://@ROOT@/top.vhdl",
+ "range": {
+ "start": {
+ "line": 13,
+ "character": 2
+ },
+ "end": {
+ "line": 13,
+ "character": 7
+ }
+ }
+ },
+ "containerName": {
+ "kind": 2,
+ "name": "rtl",
+ "location": {
+ "uri": "file://@ROOT@/top.vhdl",
+ "range": {
+ "start": {
+ "line": 10,
+ "character": 0
+ },
+ "end": {
+ "line": 21,
+ "character": 0
+ }
+ }
+ }
+ }
+ }
+ ]
+ },
+ {
+ "jsonrpc": "2.0",
+ "method": "textDocument/publishDiagnostics",
+ "params": {
+ "uri": "file://@ROOT@/top.vhdl",
+ "diagnostics": []
+ }
+ },
+ {
+ "jsonrpc": "2.0",
+ "id": 2,
+ "result": [
+ {
+ "kind": 2,
+ "name": "top",
+ "location": {
+ "uri": "file://@ROOT@/top.vhdl",
+ "range": {
+ "start": {
+ "line": 3,
+ "character": 0
+ },
+ "end": {
+ "line": 8,
+ "character": 0
+ }
+ }
+ }
+ },
+ {
+ "kind": 2,
+ "name": "rtl",
+ "location": {
+ "uri": "file://@ROOT@/top.vhdl",
+ "range": {
+ "start": {
+ "line": 10,
+ "character": 0
+ },
+ "end": {
+ "line": 21,
+ "character": 0
+ }
+ }
+ }
+ },
+ {
+ "kind": 6,
+ "name": "adder",
+ "location": {
+ "uri": "file://@ROOT@/top.vhdl",
+ "range": {
+ "start": {
+ "line": 13,
+ "character": 2
+ },
+ "end": {
+ "line": 13,
+ "character": 7
+ }
+ }
+ },
+ "containerName": {
+ "kind": 2,
+ "name": "rtl",
+ "location": {
+ "uri": "file://@ROOT@/top.vhdl",
+ "range": {
+ "start": {
+ "line": 10,
+ "character": 0
+ },
+ "end": {
+ "line": 21,
+ "character": 0
+ }
+ }
+ }
+ }
+ }
+ ]
+ }
+]
diff --git a/testsuite/pyunit/lsp/010ls28/top.vhdl b/testsuite/pyunit/lsp/010ls28/top.vhdl
new file mode 100644
index 000000000..d371cce2e
--- /dev/null
+++ b/testsuite/pyunit/lsp/010ls28/top.vhdl
@@ -0,0 +1,22 @@
+library ieee;
+use ieee.std_logic_1164.all;
+
+entity top is
+ port (
+ clk : in std_logic;
+ sum : out std_logic
+ );
+end entity;
+
+architecture rtl of top is
+begin
+
+ adder : entity work.adder(comb)
+ port map(
+ a => clk,
+ b => '1',
+ o => sum,
+ c => open
+ );
+
+end architecture;
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 ad55439e1..79c891868 100644
--- a/testsuite/pyunit/lsp/LanguageServer.py
+++ b/testsuite/pyunit/lsp/LanguageServer.py
@@ -223,3 +223,21 @@ class Test008_Error_NoFile(JSONTest):
def test_Request_Response(self):
self._RequestResponse("cmds.json", "replies.json")
+
+class Test009_ls_122(JSONTest):
+ subdir = Path("009ls122")
+
+ def test_Request_Response(self):
+ self._RequestResponse("cmds.json", "replies.json")
+
+class Test010_ls_28(JSONTest):
+ subdir = Path("010ls28")
+
+ 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")
diff --git a/testsuite/pyunit/lsp/README b/testsuite/pyunit/lsp/README
new file mode 100644
index 000000000..ec8f614e2
--- /dev/null
+++ b/testsuite/pyunit/lsp/README
@@ -0,0 +1,45 @@
+# To run the LSP testsuite
+Assuming pyGHDL is installed (Hint: use pip install -U -e),
+
+> pytest
+
+or
+
+> pytest-3
+
+
+# To add a test
+
+Enable traces:
+
+> export GHDL_LS_TRACE=ghdl-ls
+
+Run the session
+
+> code .
+(or your preferred editor)
+
+This creates two files (or more): `ghdl-ls.in` and `ghdl-ls.out`
+Those are raw dumps of the LSP data.
+
+Create a new test directory (increment the number):
+
+> mkdir 099mytest
+> cd 099mytest
+
+Transforms those files in json (which are easier to read and to process):
+
+> python3 -m pyGHDL.lsp.lsptools lsp2json < xxx/ghdl-ls.in > cmds.json
+> python3 -m pyGHDL.lsp.lsptools lsp2json < xxx/ghdl-ls.out > replies.json
+
+Substitute the root directory with `@ROOT@` (for privacy and relocation):
+(The root directory is the parent directory of the test, so it is
+ xxx/ghdl/testsuite/pyunit/lsp)
+
+> sed -i -e 's!/home/me/test!@ROOT@' cmds.json
+> sed -i -e 's!/home/me/test!@ROOT@' replies.json
+
+Add a test in LanguageServer.py (use existing tests as a template)
+
+Adjust or improve this file.
+