@@ -485,6 +485,27 @@ async def sleep(self, seconds: float) -> None:
485485 wait_factor : int = int (os .environ .get ("ALS_WAIT_FACTOR" , "1" ))
486486 await asyncio .sleep (seconds * wait_factor )
487487
488+ async def getProjectAttributeValue (
489+ self , attribute : str , pkg : str = "" , index : str = ""
490+ ) -> str | list [str ]:
491+ """Send a workspace/executeCommand request with command
492+ 'als-get-project-attribute-value' to retrieve an attribute of the loaded
493+ project.
494+ """
495+ result = await self .workspace_execute_command_async (
496+ ExecuteCommandParams (
497+ command = "als-get-project-attribute-value" ,
498+ arguments = [{"attribute" : attribute , "pkg" : pkg , "index" : index }],
499+ )
500+ )
501+
502+ assert isinstance (result , str ) or (
503+ isinstance (result , list )
504+ and all (lambda x : isinstance (x , str ) for x in result )
505+ ), f"Unexpected type of result: { result } "
506+
507+ return result
508+
488509
489510def als_client_factory () -> ALSLanguageClient :
490511 """This function is an ugly copy-paste of pytest_lsp.make_test_lsp_client. It is
@@ -634,7 +655,7 @@ def test(
634655 """
635656
636657 async def async_wrapper (
637- func : Callable [[ALSLanguageClient ], Awaitable [object ]]
658+ func : Callable [[ALSLanguageClient ], Awaitable [object ]],
638659 ) -> None :
639660 als = os .environ .get ("ALS" , "ada_language_server" )
640661 command = [als ]
0 commit comments