Switch to URI#toASCIIString()

This commit is contained in:
aboyko
2023-01-12 16:31:50 -05:00
parent c1accd1016
commit 8db31656a9
72 changed files with 166 additions and 158 deletions

View File

@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2018, 2019 Pivotal, Inc.
* Copyright (c) 2018, 2023 Pivotal, Inc.
* 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
@@ -79,7 +79,7 @@ public class HighlightsCodeLensProvider extends AbstractCodeMiningProvider {
List<LSPDocumentInfo> docInfos = LanguageServiceAccessor.getLSPDocumentInfosFor(document, (x) -> true);
if (!docInfos.isEmpty()) {
LSPDocumentInfo info = docInfos.get(0);
HighlightParams highlights = STS4LanguageClientImpl.currentHighlights.get(info.getFileUri().toString());
HighlightParams highlights = STS4LanguageClientImpl.currentHighlights.get(info.getFileUri().toASCIIString());
if (highlights != null) {
return highlights.getCodeLenses().stream()
.filter(codeLens -> codeLens.getCommand() != null)

View File

@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2017, 2022 Pivotal, Inc.
* Copyright (c) 2017, 2023 Pivotal, Inc.
* 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
@@ -213,7 +213,7 @@ public class STS4LanguageClientImpl extends LanguageClientImpl implements STS4La
} else {
URI uri = Utils.findDocUri(doc);
if (uri != null) {
updateHighlightAnnotations(editor, sourceViewer, annotationModel, uri.toString(), updateCodeMinings);
updateHighlightAnnotations(editor, sourceViewer, annotationModel, uri.toASCIIString(), updateCodeMinings);
}
}
}
@@ -472,7 +472,7 @@ public class STS4LanguageClientImpl extends LanguageClientImpl implements STS4La
IDocument doc = editor.getDocumentProvider().getDocument(editor.getEditorInput());
if (doc!=null) {
URI uri = Utils.findDocUri(doc);
if (cursorMovement.getUri().equals(uri.toString())) {
if (cursorMovement.getUri().equals(uri.toASCIIString())) {
org.eclipse.lsp4j.Position pos = cursorMovement.getPosition();
int offset = LSPEclipseUtils.toOffset(pos, doc);
Display.getDefault().asyncExec(() -> {
@@ -520,7 +520,7 @@ public class STS4LanguageClientImpl extends LanguageClientImpl implements STS4La
if (project != null) {
Location location = new Location();
String label = javaLabelProvider.getText(element);
location.setUri(Utils.eclipseIntroUri(project.getElementName(), params.getBindingKey(), label).toString());
location.setUri(Utils.eclipseIntroUri(project.getElementName(), params.getBindingKey(), label).toASCIIString());
// Set the range because LocationLink needs it to be non-null. The target range
// would highlighted by the eclipse intro URL navigation anyway
location.setRange(new Range());

View File

@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2018, 2020 Pivotal, Inc.
* Copyright (c) 2018, 2023 Pivotal, Inc.
* 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
@@ -78,7 +78,7 @@ public class Utils {
for (LSPDocumentInfo info : LanguageServiceAccessor.getLSPDocumentInfosFor(doc, (x) -> true)) {
if (info.getVersion() == id.getVersion()) {
URI uri = info.getFileUri();
if (uri != null && uri.toString().equals(id.getUri())) {
if (uri != null && uri.toASCIIString().equals(id.getUri())) {
return true;
}
}