-
Notifications
You must be signed in to change notification settings - Fork 93
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Server capabilities managed better, user can disable formatting from …
…preferences Fixes #104 Signed-off-by: Nikolas Komonen <nikolaskomonen@gmail.com>
- Loading branch information
1 parent
79055fb
commit e08053d
Showing
15 changed files
with
716 additions
and
37 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,15 @@ | ||
{ | ||
// Use IntelliSense to learn about possible attributes. | ||
// Hover to view descriptions of existing attributes. | ||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"type": "java", | ||
"name": "Debug (Attach)", | ||
"request": "attach", | ||
"hostName": "localhost", | ||
"port": 1054 | ||
} | ||
] | ||
} | ||
// Use IntelliSense to learn about possible attributes. | ||
// Hover to view descriptions of existing attributes. | ||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"type": "java", | ||
"name": "Debug (Attach)", | ||
"request": "attach", | ||
"hostName": "localhost", | ||
"port": 1054 | ||
} | ||
] | ||
} |
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
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
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
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
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
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
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
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
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
94 changes: 94 additions & 0 deletions
94
...ml/src/main/java/org/eclipse/lsp4xml/settings/capabilities/ClientCapabilitiesWrapper.java
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,94 @@ | ||
/** | ||
* Copyright (c) 2018 Red Hat, Inc. and others. | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v1.0 | ||
* which accompanies this distribution, and is available at | ||
* http://www.eclipse.org/legal/epl-v10.html | ||
* | ||
* Contributors: | ||
* Red Hat Inc. - initial API and implementation | ||
*/ | ||
|
||
package org.eclipse.lsp4xml.settings.capabilities; | ||
|
||
import org.eclipse.lsp4j.ClientCapabilities; | ||
import org.eclipse.lsp4j.DynamicRegistrationCapabilities; | ||
import org.eclipse.lsp4j.TextDocumentClientCapabilities; | ||
|
||
/** | ||
* Determines if a client supports a specific capability dynamically | ||
*/ | ||
public class ClientCapabilitiesWrapper { | ||
private boolean v3Supported; | ||
|
||
public ClientCapabilities capabilities; | ||
|
||
public ClientCapabilitiesWrapper() { | ||
this.capabilities = new ClientCapabilities(); | ||
this.v3Supported = false; | ||
} | ||
public ClientCapabilitiesWrapper(ClientCapabilities capabilities) { | ||
this.capabilities = capabilities; | ||
this.v3Supported = capabilities != null ? capabilities.getTextDocument() != null : false; | ||
} | ||
|
||
/** | ||
* IMPORTANT | ||
* | ||
* This should be up to date with all Server supported capabilities | ||
* | ||
*/ | ||
|
||
public boolean isCompletionDynamicRegistrationSupported() { | ||
return v3Supported && isDynamicRegistrationSupported(getTextDocument().getCompletion()); | ||
} | ||
|
||
public boolean isLinkDynamicRegistrationSupported() { | ||
return v3Supported && isDynamicRegistrationSupported(getTextDocument().getDocumentLink()); | ||
} | ||
|
||
public boolean isRangeFoldingDynamicRegistrationSupported() { | ||
return v3Supported && isDynamicRegistrationSupported(getTextDocument().getFoldingRange()); | ||
} | ||
|
||
public boolean isDocumentSyncDynamicRegistrationSupported() { | ||
return v3Supported && isDynamicRegistrationSupported(getTextDocument().getSynchronization()); | ||
} | ||
|
||
public boolean isFormattingDynamicRegistrationSupported() { | ||
return v3Supported && isDynamicRegistrationSupported(getTextDocument().getFormatting()); | ||
} | ||
|
||
public boolean isRangeFormattingDynamicRegistrationSupported() { | ||
return v3Supported && isDynamicRegistrationSupported(getTextDocument().getRangeFormatting()); | ||
} | ||
|
||
public boolean isRenameDynamicRegistrationSupported() { | ||
return v3Supported && isDynamicRegistrationSupported(getTextDocument().getRename()); | ||
} | ||
|
||
public boolean isDocumentSymbolDynamicRegistered() { | ||
return v3Supported && isDynamicRegistrationSupported(getTextDocument().getDocumentSymbol()); | ||
} | ||
|
||
public boolean isCodeActionDynamicRegistered() { | ||
return v3Supported && isDynamicRegistrationSupported(getTextDocument().getCodeAction()); | ||
} | ||
|
||
public boolean isHoverDynamicRegistered() { | ||
return v3Supported && isDynamicRegistrationSupported(getTextDocument().getHover()); | ||
} | ||
|
||
public boolean isDocumentHighlightDynamicRegistered() { | ||
return v3Supported && isDynamicRegistrationSupported(getTextDocument().getDocumentHighlight()); | ||
} | ||
|
||
private boolean isDynamicRegistrationSupported(DynamicRegistrationCapabilities capability) { | ||
return capability != null && capability.getDynamicRegistration().booleanValue(); | ||
} | ||
|
||
public TextDocumentClientCapabilities getTextDocument() { | ||
return this.capabilities.getTextDocument(); | ||
} | ||
|
||
} |
Oops, something went wrong.