Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vscode-quarkus should not be a Java formatter #166

Closed
xorye opened this issue Nov 29, 2019 · 5 comments · Fixed by redhat-developer/quarkus-ls#332
Closed

vscode-quarkus should not be a Java formatter #166

xorye opened this issue Nov 29, 2019 · 5 comments · Fixed by redhat-developer/quarkus-ls#332
Assignees
Labels
bug Something isn't working
Milestone

Comments

@xorye
Copy link
Contributor

xorye commented Nov 29, 2019

vscode-quarkus should not be a Java formatter.

To reproduce this issue:

  1. Open a Java file while vscode-quarkus is running.
  2. Right click in the editor and click "Format Document With..."
  3. The user is now prompted to choose a formatter:
    image

The "Quarkus" entry should not be present in this list, since VS Code Quarkus does not format Java files.

@angelozerr
Copy link
Contributor

I think this problem comes from since we have supported CodeLens and Hover in Java file with Quarkus LS. I fear that there is no solution.

@fbricon
Copy link
Collaborator

fbricon commented Dec 12, 2019

@jrieken @aeschli any idea on how to get the language server register the formatter for the quarkus-properties type/language and not for java? (See https://github.com/redhat-developer/vscode-quarkus/blob/master/src/extension.ts#L128)

@jrieken
Copy link

jrieken commented Dec 16, 2019

This UI shows all installed extensions, it doesn't check if or what formatter an extension provides because we don't know that statically.... Tho, we could show formatters that we have seen contribute a formatter for that language in the past first.

@angelozerr
Copy link
Contributor

angelozerr commented Jan 2, 2020

@fbricon perhaps it should be better to have 2 language server :

  • one for application.properties
  • one for java file.

Today Java CodeLens, Hover uses application.properties file and don't require projectInfo, so I think we could move Java features in a new language server. Having a new language server for Java, will give the format capability as none and will fix this issue.

What do you think about that?

@angelozerr
Copy link
Contributor

angelozerr commented May 26, 2020

I don't know if it could work, but by reading microsoft/language-server-protocol#996 we could try to follow the suggestion microsoft/language-server-protocol#996 (comment)

In other words when regitser capability for format (textDocument/formatting and textDocument/rangeFormatting) is sent from the server at https://github.com/redhat-developer/quarkus-ls/blob/27d554f92d8d545145410fc34cf3815f86a117bd/microprofile.ls/com.redhat.microprofile.ls/src/main/java/com/redhat/microprofile/settings/capabilities/MicroProfileCapabilityManager.java#L106 we could add documentSelector to say that only language microprofile-properties and quarkus-properties are supported.

{
	"method": "client/registerCapability",
	"params": {
		"registrations": [
			{
				"id": "79eee87c-c409-4664-8102-e03263673f6f",
				"method": "textDocument/formatting",
				"registerOptions": {
					"documentSelector": [
						{ "language": "microprofile-properties" },
						{ "language": "quarkus-properties" }
					]
				}
			}
		]
	}
}

@fbricon fbricon added this to the 1.6.0 milestone Jun 24, 2020
angelozerr added a commit to angelozerr/quarkus-ls that referenced this issue Jul 1, 2020
angelozerr added a commit to angelozerr/quarkus-ls that referenced this issue Jul 1, 2020
angelozerr added a commit to angelozerr/quarkus-ls that referenced this issue Jul 3, 2020
angelozerr added a commit to angelozerr/quarkus-ls that referenced this issue Jul 3, 2020
angelozerr added a commit to angelozerr/quarkus-ls that referenced this issue Jul 3, 2020
angelozerr added a commit to angelozerr/quarkus-ls that referenced this issue Jul 3, 2020
angelozerr added a commit to angelozerr/quarkus-ls that referenced this issue Jul 3, 2020
angelozerr added a commit to angelozerr/quarkus-ls that referenced this issue Jul 3, 2020
angelozerr added a commit to angelozerr/quarkus-ls that referenced this issue Jul 3, 2020
angelozerr added a commit to redhat-developer/quarkus-ls that referenced this issue Jul 3, 2020
@xorye xorye added the bug Something isn't working label Jul 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants