Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[lsp4e-dev] LanguageClientImpl.workspaceFolders() never used?
  • From: Ruben Porras Campo <Ruben.PorrasCampo@xxxxxxxxxx>
  • Date: Tue, 7 Dec 2021 15:26:40 +0000
  • Accept-language: es-ES, en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=avaloq.com; dmarc=pass action=none header.from=avaloq.com; dkim=pass header.d=avaloq.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=YF+LMJvhQ38zLIJ4HmToLqQiMcIxbz2ukWiPVy3wuKE=; b=gI3VTRUjapsWwF/Ca6vI0qsJmOaMafMF1pjC7pjSlHxaikADookqTBFMwS3gWXF+fiaGakj1DlM3Mx0X5+yomO9R4vnu07W+4Q6s+eSo6sFgneWE+VmfKBbMXZdFTBRAIIMu4lABaUb6nYXQWa63zwk2ZW/n4tJkVZ8H+o2moII7P9kaeU1r2GEea3LtxLOCHx3YORCOSsxknaHnQCtAdeKGmupo/t6jGrEK229bhnXJPH1/UrAKEeFJTu1L8Oqd62MkFx9AL9kvOUlIVcgg+fNB10iQ4mlbDzvfgqb+of6t2mGMoh+4/85c98T+vktg2NAqNbSjfWoJ05mpBro4KA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KjAIYaflzMxx/8JbbYGO0fIsJSRmA5PZKr7wGBxaaTxuY0IAtYxOZfpJw3ZJXHeeUzpowbd+A7M1iHlF0Nc4waQ8XMUYkNqLiBSaEf053eYvV+elmNasOOj9/2lKoMIAowJt0ia0oZ1Z8ASgk1r5DLGvnjtpi4oXHQqy6m90XeY72CJFFYz0c7Y06E8svSd8KRtC21luLf8EJTHpf2iSec7zwsPh9wUTEZOFfkHThfbG5QiTRJqaWPecW41PFP25HDHp/aHjXQhtutpoaAsHtoxmV/WS3sYmJCWGTqYXpCB2gjEz4fKVJmKD5153Um6oGwRVolr98Ldq4SZ5BGIq4g==
  • Delivered-to: lsp4e-dev@xxxxxxxxxxx
  • List-archive: <https://www.eclipse.org/mailman/private/lsp4e-dev/>
  • List-help: <mailto:lsp4e-dev-request@eclipse.org?subject=help>
  • List-subscribe: <https://www.eclipse.org/mailman/listinfo/lsp4e-dev>, <mailto:lsp4e-dev-request@eclipse.org?subject=subscribe>
  • List-unsubscribe: <https://www.eclipse.org/mailman/options/lsp4e-dev>, <mailto:lsp4e-dev-request@eclipse.org?subject=unsubscribe>
  • Thread-index: AdfrfNGfETcpv7lyR/2Ac4WyyEWmMg==
  • Thread-topic: LanguageClientImpl.workspaceFolders() never used?

Hi all,

 

I would like to configure LSP4E to filter out some eclipse projects (not only the closed ones) and do not know how to make it work. Could anyone help me?

 

I have seen that the class LanguageClientImpl can be overridden/reimplemented, and then a custom implementation can used the extension point org.eclipse.lsp4e.languageServer (clientImpl property). That class has an interface

 

       /**

       * The workspace/workspaceFolders request is sent from the server to the client

       * to fetch the current open list of workspace folders.

       *

       * @return null in the response if only a single file is open in the tool,

       *         an empty array if a workspace is open but no folders are configured,

       *         the workspace folders otherwise.

       */

       @JsonRequest("workspace/workspaceFolders")

       default CompletableFuture<List<WorkspaceFolder>> workspaceFolders() {

              throw new UnsupportedOperationException();

       }

 

I expected that by creating my own implementation, I could filter the projects as desired, but from my observation that is not the case: the code is never called. Apparently a similar code to the one in org.eclipse.lsp4e.LanguageClientImpl.workspaceFolders() is present as well in LanguageServerWrapper.watchProjects(), and that is the one that is called:

 

                wsFolderEvent.getAdded().addAll(Arrays.stream(ResourcesPlugin.getWorkspace().getRoot().getProjects()).filter(IProject::isAccessible).map(LSPEclipseUtils::toWorkspaceFolder).collect(Collectors.toList()));

 

and causes the Language Server to be aware of projects I would like to filter out.

 

Should this code not call the client implementation provided by LanguageClientImpl (which is exactly the same) or any other custom implementation, instead of providing its own hardcoded version?

 

I have tried to understand by myself if it is by intention that LanguageClient#workspaceFolders() is not called or if it is a bug, but I could not figure it out. Assuming it is a bug, I also tried to figure out how to change LanguageServerWrapper.watchProjects() to call the custom implementation, but it is not clear to me how one would achieve that, it looks like the LanguageClient has a reference to the wrapper, but not the other way around.

 

Would you have any idea how to solve my problems?

 

Ruben Porras Campo

Software Architect

Avaloq

T: +41 58 3162573 | ruben.porrascampo@xxxxxxxxxx

Allmendstrasse 140 | CH-8027 Zürich | Switzerland

www.avaloq.com | LinkedIn | Facebook | Instagram | Twitter

 


Please consider the environment before printing this e-mail.


IMPORTANT: This e-mail and any attachments contain information which is for the sole attention and use of the intended recipient. If this e-mail has been sent to you in error, please advise the sender of the error or contact Avaloq, completely delete the message and do not forward it or inform any other person of its contents. WARNING: E-mails can involve substantial risks e.g. lack of confidentiality, potential manipulation of contents and/or sender's address, incorrect recipient (misdirection), viruses etc. Avaloq assumes no responsibility for any loss or damage resulting from the use of e-mails. It is recommended that you do not send any sensitive information by unsecured e-mail. As a matter of principle, Avaloq does not accept any orders sent by e-mail and is not obliged to act on or respond to the e-mail.

Back to the top