lsp-java icon indicating copy to clipboard operation
lsp-java copied to clipboard

Activate profiles in lsp server so that the pom parent can be resolved

Open arichiardi opened this issue 6 years ago • 5 comments

Describe the bug The LSP server starts but no action is displayed.

To Reproduce Get a multi module project, for instance

        <modules>
		<module>tenant-service-handler</module>
		<module>tenant-service-model</module>
		<module>tenant-service-logic</module>
		<module>tenant-service-dao</module>
		<module>tenant-service-events</module>
	</modules>

I have checked #127 but it seems like it is not my case.

Logs

[X] /home/arichiardi/git/tenant-service/tenant-service-model/
[X] /home/arichiardi/git/tenant-service/tenant-service-handler/
[X] /home/arichiardi/git/tenant-service/tenant-service-events/
[X] /home/arichiardi/git/tenant-service/tenant-service-dao/
[-] /home/arichiardi/git/tenant-service/tenant-service-logic/
 `-[-] jdtls:26448
    |-[-] Buffers
    |  `-[X] TenantLogic.java
    `-[-] Capabilities
       |-[-] workspace:
       |  `-[-] workspaceFolders:
       |     |-[X] changeNotifications: t
       |     `-[X] supported: t
       |-[-] executeCommandProvider:
       |  `-[X] commands: [java.edit.organizeImports vscode.java.fetchUsageData java.project.removeFromSourcePath java.project.listSourcePaths sts.java.search.packages sts.java.javadocHoverLink sts.java.search.types sts.java.hierarchy.supertypes sts.java.hierarchy.subtypes java.project.updateSourceAttachment vscode.java.resolveClasspath sts.java.addClasspathListener vscode.java.resolveMainClass vscode.java.updateDebugSettings sts.java.location java.project.resolveSourceAttachment vscode.java.buildWorkspace sts.java.javadoc sts.java.removeClasspathListener java.project.addToSourcePath vscode.java.startDebugSession sts.java.type]
       |-[-] renameProvider:
       |  `-[X] prepareProvider: t
       |-[-] documentOnTypeFormattingProvider:
       |  |-[X] moreTriggerCharacter: [
 }]
       |  `-[X] firstTriggerCharacter: ;
       |-[X] documentRangeFormattingProvider: t
       |-[-] codeLensProvider:
       |  `-[X] resolveProvider: t
       |-[X] workspaceSymbolProvider: t
       |-[X] documentSymbolProvider: t
       |-[X] documentHighlightProvider: t
       |-[X] referencesProvider: t
       |-[X] implementationProvider: t
       |-[X] typeDefinitionProvider: t
       |-[X] definitionProvider: t
       |-[-] signatureHelpProvider:
       |  `-[X] triggerCharacters: [(]
       |-[-] completionProvider:
       |  |-[X] triggerCharacters: [. @ # *]
       |  `-[X] resolveProvider: t
       |-[X] hoverProvider: t
       `-[-] textDocumentSync:
          |-[-] save:
          |  `-[X] includeText: t
          |-[X] willSaveWaitUntil: t
          |-[X] willSave: t
          |-[X] change: 2
          `-[X] openClose: t

Thanks for this project, it is a life saver for folks who don't want to use Intellij for Java!

arichiardi avatar May 29 '19 21:05 arichiardi

One more thing, sometimes I have a:

29-May-2019 2:12:17 PM file:///home/arichiardi/git/tenant-service/tenant-service-logic/src/main/java/com/elasticpath/service/tenant/logic/TenantLogic.java does not resolve to a ICompilationUnit

in *lsp-log*.

arichiardi avatar May 29 '19 21:05 arichiardi

Generally, you should import the project root. Based on the session structure you have imported only one project from the module and you have associated only it with the current session. I would suggest you to remove all workspace folders via lsp-workspace-folders-remove and import only the parent project. If this doesn't help please provide a project to reproduce the issue with.

yyoncho avatar May 30 '19 05:05 yyoncho

Ok perfect will try and report back, thanks for the prompt answer!

arichiardi avatar May 30 '19 05:05 arichiardi

It turns out that the problem is because we have a parent pom in the project

<parent>
	<groupId>...</groupId>
	<artifactId>grandparent</artifactId>
</parent>

Which need a profile active for being visible (it's stored in an internal repo).

Commenting it out solves and I can actually see everything again.

My next question then would be, is there a way to tell the server to resolve/activate this profile?

arichiardi avatar May 30 '19 17:05 arichiardi

No still, something is off. In some project nothing is being shown. I will need to investigate more.

arichiardi avatar May 30 '19 17:05 arichiardi