-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add defensive code when computing tooltip text
In particular we should not even try to compute the variables' declarations if the root project could not be parsed. Add automatic test for this. For eng/ide/gnatstudio#345
- Loading branch information
1 parent
9b94c68
commit f56621f
Showing
7 changed files
with
205 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
testsuite/gpr_lsp/hover.no_exception_when_failed_to_load/prj1.gpr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
project Prj1 is | ||
for Source_Dirs use ("src"); | ||
package Compiler is | ||
for Switches ("Ada") use (); | ||
end Compiler; | ||
package IDE is | ||
for Artifacts_Dir use ""; | ||
end IDE; | ||
end Prj1; |
16 changes: 16 additions & 0 deletions
16
testsuite/gpr_lsp/hover.no_exception_when_failed_to_load/prj3.gpr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
with "unknown"; | ||
project Prj3 is | ||
type T is ("project.Var value "); | ||
Var : T := "project.Var value "; | ||
package Builder is | ||
Var := "project.Builder.Var value "; | ||
for Global_Configuration_Pragmas use "project.Builder'Global_Configuration_Pragmas value "; | ||
end Builder; | ||
Var1 := Var & project.Var & project.Builder.Var & project'Name & Prj3'Name & Prj3.Builder'Global_Configuration_Pragmas; | ||
package Compiler is | ||
for Switches ("main.adb") use ("value1"); | ||
for Switches ("main.adb" at 1) use ("value2"); | ||
for Switches (others) use ("value3"); | ||
Var := Compiler'Switches ("main.adb") & Compiler'Switches (others); | ||
end Compiler; | ||
end Prj3; |
168 changes: 168 additions & 0 deletions
168
testsuite/gpr_lsp/hover.no_exception_when_failed_to_load/test.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,168 @@ | ||
[ | ||
{ | ||
"comment": [ | ||
"Check that we don't get any exception when computing variables'", | ||
"tooltips on non-valid projects" | ||
] | ||
}, | ||
{ | ||
"start": { | ||
"cmd": ["${ALS}", "--language-gpr"] | ||
} | ||
}, | ||
{ | ||
"send": { | ||
"request": { | ||
"jsonrpc": "2.0", | ||
"id": "init", | ||
"method": "initialize", | ||
"params": { | ||
"processId": 441587, | ||
"rootUri": "$URI{.}", | ||
"capabilities": { | ||
"workspace": { | ||
"applyEdit": true, | ||
"workspaceEdit": {}, | ||
"didChangeConfiguration": {}, | ||
"didChangeWatchedFiles": {}, | ||
"executeCommand": {} | ||
}, | ||
"textDocument": { | ||
"synchronization": {}, | ||
"completion": { | ||
"dynamicRegistration": true, | ||
"completionItem": { | ||
"snippetSupport": true, | ||
"documentationFormat": ["plaintext", "markdown"] | ||
} | ||
}, | ||
"hover": {}, | ||
"signatureHelp": {}, | ||
"declaration": {}, | ||
"definition": {}, | ||
"typeDefinition": {}, | ||
"implementation": {}, | ||
"references": {}, | ||
"documentHighlight": {}, | ||
"documentSymbol": { | ||
"hierarchicalDocumentSymbolSupport": true | ||
}, | ||
"codeLens": {}, | ||
"colorProvider": {}, | ||
"formatting": { | ||
"dynamicRegistration": false | ||
}, | ||
"rangeFormatting": { | ||
"dynamicRegistration": false | ||
}, | ||
"onTypeFormatting": { | ||
"dynamicRegistration": false | ||
}, | ||
"foldingRange": { | ||
"lineFoldingOnly": true | ||
}, | ||
"selectionRange": {}, | ||
"linkedEditingRange": {}, | ||
"callHierarchy": {}, | ||
"moniker": {} | ||
} | ||
} | ||
} | ||
}, | ||
"wait": [ | ||
{ | ||
"jsonrpc": "2.0", | ||
"id": "init", | ||
"result": { | ||
"capabilities": { | ||
"textDocumentSync": { | ||
"openClose": true, | ||
"change": 1 | ||
} | ||
} | ||
} | ||
} | ||
] | ||
} | ||
}, | ||
{ | ||
"send": { | ||
"request": { | ||
"jsonrpc": "2.0", | ||
"method": "initialized" | ||
}, | ||
"wait": [] | ||
} | ||
}, | ||
{ | ||
"send": { | ||
"request": { | ||
"jsonrpc": "2.0", | ||
"method": "textDocument/didOpen", | ||
"params": { | ||
"textDocument": { | ||
"uri": "$URI{prj3.gpr}", | ||
"languageId": "Gpr", | ||
"version": 1, | ||
"text": "with \"unknown\";\nproject Prj3 is\n type T is (\"project.Var value \");\n Var : T := \"project.Var value \";\n package Builder is\n Var := \"project.Builder.Var value \";\n for Global_Configuration_Pragmas use \"project.Builder'Global_Configuration_Pragmas value \";\n end Builder;\n Var1 := Var & project.Var & project.Builder.Var & project'Name & Prj3'Name & Prj3.Builder'Global_Configuration_Pragmas;\n package Compiler is\n for Switches (\"main.adb\") use (\"value1\");\n for Switches (\"main.adb\" at 1) use (\"value2\");\n for Switches (others) use (\"value3\");\n Var := Compiler'Switches (\"main.adb\") & Compiler'Switches (others);\n end Compiler;\nend Prj3;\n" | ||
} | ||
} | ||
}, | ||
"wait": [] | ||
} | ||
}, | ||
{ | ||
"send": { | ||
"request": { | ||
"params": { | ||
"position": { | ||
"line": 3, | ||
"character": 3 | ||
}, | ||
"textDocument": { | ||
"uri": "$URI{prj3.gpr}" | ||
} | ||
}, | ||
"jsonrpc": "2.0", | ||
"id": 9, | ||
"method": "textDocument/hover" | ||
}, | ||
"wait": [ | ||
{ | ||
"id": 9, | ||
"result": null | ||
} | ||
] | ||
} | ||
}, | ||
{ | ||
"send": { | ||
"request": { | ||
"jsonrpc": "2.0", | ||
"id": "shutdown", | ||
"method": "shutdown", | ||
"params": null | ||
}, | ||
"wait": [ | ||
{ | ||
"id": "shutdown", | ||
"result": null | ||
} | ||
] | ||
} | ||
}, | ||
{ | ||
"send": { | ||
"request": { | ||
"jsonrpc": "2.0", | ||
"method": "exit" | ||
}, | ||
"wait": [] | ||
} | ||
}, | ||
{ | ||
"stop": { | ||
"exit_code": 0 | ||
} | ||
} | ||
] |
3 changes: 3 additions & 0 deletions
3
testsuite/gpr_lsp/hover.no_exception_when_failed_to_load/test.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
title: 'hover.no_exception_when_failed_to_load' | ||
skip: | ||
- ['SKIP', 'env.build.os.name not in ("linux","windows")'] |