You've already forked ada_language_server
mirror of
https://github.com/AdaCore/ada_language_server.git
synced 2026-02-12 12:45:50 -08:00
Merge branch 'topic/zboon' into 'master'
Add defensive code when root project is not defined See merge request eng/ide/ada_language_server!1745
This commit is contained in:
@@ -428,6 +428,7 @@ private
|
||||
overriding function Project_Tree_Is_Aggregate (Self : Message_Handler)
|
||||
return Boolean is
|
||||
(Self.Project_Tree_Is_Defined
|
||||
and then Self.Project_Tree.Root_Project.Is_Defined
|
||||
and then Self.Project_Tree.Root_Project.Kind in GPR2.Aggregate_Kind);
|
||||
|
||||
overriding procedure Reload_Project (Self : in out Message_Handler);
|
||||
|
||||
6
testsuite/ada_lsp/hover.no_root_project/default.gpr
Normal file
6
testsuite/ada_lsp/hover.no_root_project/default.gpr
Normal file
@@ -0,0 +1,6 @@
|
||||
-- Include a project that does not exist so that
|
||||
-- it fails to load in the ALS.
|
||||
with "unexisting";
|
||||
|
||||
project Default is
|
||||
end Default;
|
||||
6
testsuite/ada_lsp/hover.no_root_project/main.adb
Normal file
6
testsuite/ada_lsp/hover.no_root_project/main.adb
Normal file
@@ -0,0 +1,6 @@
|
||||
with Ada.Text_IO;
|
||||
|
||||
procedure Main is
|
||||
begin
|
||||
Ada.Text_IO.Put_Line ("Hello");
|
||||
end Main;
|
||||
138
testsuite/ada_lsp/hover.no_root_project/test.json
Normal file
138
testsuite/ada_lsp/hover.no_root_project/test.json
Normal file
@@ -0,0 +1,138 @@
|
||||
[
|
||||
{
|
||||
"comment": [
|
||||
"This test checks that the textDocument/hover request does not crash ",
|
||||
"even when the project could not be loaded properly."
|
||||
]
|
||||
},
|
||||
{
|
||||
"start": {
|
||||
"cmd": ["${ALS}"]
|
||||
}
|
||||
},
|
||||
{
|
||||
"send": {
|
||||
"request": {
|
||||
"jsonrpc": "2.0",
|
||||
"id": 0,
|
||||
"method": "initialize",
|
||||
"params": {
|
||||
"processId": 1,
|
||||
"rootUri": "$URI{.}",
|
||||
"capabilities": {}
|
||||
}
|
||||
},
|
||||
"wait": [
|
||||
{
|
||||
"id": 0,
|
||||
"result": {
|
||||
"capabilities": {
|
||||
"textDocumentSync": 2
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"send": {
|
||||
"request": {
|
||||
"jsonrpc": "2.0",
|
||||
"method": "initialized"
|
||||
},
|
||||
"wait": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"send": {
|
||||
"request": {
|
||||
"jsonrpc": "2.0",
|
||||
"method": "workspace/didChangeConfiguration",
|
||||
"params": {
|
||||
"settings": {
|
||||
"ada": {
|
||||
"projectFile": "$URI{default.gpr}",
|
||||
"scenarioVariables": {},
|
||||
"defaultCharset": "ISO-8859-1",
|
||||
"enableDiagnostics": false,
|
||||
"followSymlinks": false,
|
||||
"documentationStyle": "gnat",
|
||||
"namedNotationThreshold": 3,
|
||||
"foldComments": false
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"wait": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"send": {
|
||||
"request": {
|
||||
"jsonrpc": "2.0",
|
||||
"method": "textDocument/didOpen",
|
||||
"params": {
|
||||
"textDocument": {
|
||||
"uri": "$URI{main.adb}",
|
||||
"languageId": "Ada",
|
||||
"version": 0,
|
||||
"text": "with Ada.Text_IO;\n\nprocedure Main is\n\nbegin Ada.Text_IO.Put_Line (\"Hello\");\nend Main;\n"
|
||||
}
|
||||
}
|
||||
},
|
||||
"wait": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"send": {
|
||||
"request": {
|
||||
"jsonrpc": "2.0",
|
||||
"id": 4,
|
||||
"method": "textDocument/hover",
|
||||
"params": {
|
||||
"textDocument": {
|
||||
"uri": "$URI{main.adb}"
|
||||
},
|
||||
"position": {
|
||||
"line": 0,
|
||||
"character": 12
|
||||
}
|
||||
}
|
||||
},
|
||||
"wait": [
|
||||
{
|
||||
"id": 4,
|
||||
"result": {
|
||||
"contents": [
|
||||
"<HAS>",
|
||||
{
|
||||
"language": "ada",
|
||||
"value": "package Ada.Text_IO"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"send": {
|
||||
"request": {
|
||||
"jsonrpc": "2.0",
|
||||
"id": 7,
|
||||
"method": "shutdown"
|
||||
},
|
||||
"wait": [
|
||||
{
|
||||
"id": 7,
|
||||
"result": null
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"stop": {
|
||||
"exit_code": 0
|
||||
}
|
||||
}
|
||||
]
|
||||
1
testsuite/ada_lsp/hover.no_root_project/test.yaml
Normal file
1
testsuite/ada_lsp/hover.no_root_project/test.yaml
Normal file
@@ -0,0 +1 @@
|
||||
title: 'hover.no_root_project'
|
||||
Reference in New Issue
Block a user