-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'topic/als.1516.allow_null' into 'master'
Allow null as the kind when parsing a configuration setting See merge request eng/ide/ada_language_server!1903
- Loading branch information
Showing
3 changed files
with
63 additions
and
3 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
55 changes: 55 additions & 0 deletions
55
testsuite/ada_lsp/configuration_warning_null_setting/test.py
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,55 @@ | ||
""" | ||
Verify we are sending showMessages in response of invalid configuration but | ||
not when resetting it using a null value for a setting. | ||
""" | ||
|
||
import asyncio | ||
from drivers.pylsp import ( | ||
ALSLanguageClient, | ||
assertEqual, | ||
test, | ||
) | ||
|
||
EXPECTED = [ | ||
'Unknown Ada setting "unknownAttr".', | ||
'Ada settings are case sensitive: "USEGNATFORMAT" has been ignored ' | ||
+ 'please set it to "useGnatformat".', | ||
'Invalid type for the Ada setting "logThreshold" please check the value.', | ||
] | ||
|
||
|
||
@test() | ||
async def main(lsp: ALSLanguageClient) -> None: | ||
# There is no config file | ||
lsp.didOpenVirtual() | ||
|
||
# Disable mypy warning for the ignore below, it's detecting unknown | ||
# attribute for didChangeConfig which is the goal of the test | ||
lsp.didChangeConfig( | ||
{ | ||
"unknownAttr": "Hello", # type: ignore | ||
"USEGNATFORMAT": False, # type: ignore | ||
"logThreshold": False, | ||
"insertWithClauses": True, | ||
"gprConfigurationFile": None, | ||
} | ||
) | ||
|
||
# Wait for didChangeConfig to be handled | ||
await asyncio.sleep(2) | ||
|
||
total_log_msg = len(lsp.log_messages) | ||
total_show_msg = len(lsp.messages) | ||
# the first logMessage is about the log file location, ignore it | ||
assertEqual([msg.message for msg in lsp.log_messages[1:]], EXPECTED) | ||
assertEqual([msg.message for msg in lsp.messages], EXPECTED) | ||
|
||
lsp.didChangeConfig({"logThreshold": None, "insertWithClauses": None}) | ||
|
||
# Wait for didChangeConfig to be handled | ||
await asyncio.sleep(2) | ||
|
||
# Check that no messages were sent after using None/null as the value for | ||
# a setting | ||
assertEqual(len(lsp.log_messages), total_log_msg) | ||
assertEqual(len(lsp.messages), total_show_msg) |
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 @@ | ||
driver: pylsp |