From 78a10a440c006c5f8b7db8a54654ccc1bac4ae4f Mon Sep 17 00:00:00 2001 From: Christian Dietrich Date: Wed, 4 Mar 2020 19:20:32 +0100 Subject: [PATCH] [eclipse/xtext#1679] converted more Xtend code to Java Signed-off-by: Christian Dietrich --- .../ide/TestLangLSPExtension.java | 7 +- .../eclipse/xtext/ide/DefaultIdeModule.java | 34 +-- .../eclipse/xtext/ide/DefaultIdeModule.xtend | 39 --- .../ide/editor/bracketmatching/BracePair.java | 103 ++++++++ .../editor/bracketmatching/BracePair.xtend | 37 --- .../DefaultBracePairProvider.java | 37 +++ .../DefaultBracePairProvider.xtend | 34 --- ...Provider.xtend => IBracePairProvider.java} | 10 +- .../XtextBracePairProvider.java | 11 +- .../XtextBracePairProvider.xtend | 26 -- .../{INavigatable.xtend => INavigatable.java} | 22 +- ...or.xtend => ICapabilitiesContributor.java} | 12 +- .../ide/server/ILanguageServerAccess.java | 166 ++++++++++++ .../ide/server/ILanguageServerAccess.xtend | 104 -------- .../ide/server/ILanguageServerExtension.java | 33 +++ .../ide/server/ILanguageServerExtension.xtend | 31 --- .../xtext/ide/server/LanguageServerImpl.java | 5 + .../xtext/ide/server/ServerModule.java | 37 +++ .../xtext/ide/server/ServerModule.xtend | 36 --- .../codeActions/ICodeActionService2.java | 80 ++++++ .../codeActions/ICodeActionService2.xtend | 39 --- .../server/codelens/ICodeLensResolver.java | 18 +- .../server/codelens/ICodeLensResolver.xtend | 25 -- .../ide/server/codelens/ICodeLensService.java | 21 +- .../server/codelens/ICodeLensService.xtend | 28 -- .../commands/IExecutableCommandService.java | 5 +- .../commands/IExecutableCommandService.xtend | 37 --- .../xtext/ide/server/hover/HoverContext.java | 63 +++++ .../xtext/ide/server/hover/HoverService.xtend | 15 +- ...manticHighlightingStyleToTokenMapper.java} | 44 ++-- .../util/CancelIndicatorProgressMonitor.java | 60 +++++ .../util/CancelIndicatorProgressMonitor.xtend | 52 ---- .../ide/editor/bracketmatching/BracePair.java | 109 -------- .../DefaultBracePairProvider.java | 45 ---- .../bracketmatching/IBracePairProvider.java | 29 --- .../ide/editor/navigation/INavigatable.java | 31 --- .../ide/server/ICapabilitiesContributor.java | 23 -- .../ide/server/ILanguageServerAccess.java | 246 ------------------ .../ide/server/ILanguageServerExtension.java | 33 --- .../xtext/ide/server/ServerModule.java | 42 --- .../codeActions/ICodeActionService2.java | 88 ------- .../xtext/ide/server/hover/HoverContext.java | 66 ----- ...emanticHighlightingStyleToTokenMapper.java | 61 ----- .../util/CancelIndicatorProgressMonitor.java | 64 ----- 44 files changed, 681 insertions(+), 1427 deletions(-) rename org.eclipse.xtext.ide/{xtend-gen => src}/org/eclipse/xtext/ide/DefaultIdeModule.java (55%) delete mode 100644 org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/DefaultIdeModule.xtend create mode 100644 org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/editor/bracketmatching/BracePair.java delete mode 100644 org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/editor/bracketmatching/BracePair.xtend create mode 100644 org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/editor/bracketmatching/DefaultBracePairProvider.java delete mode 100644 org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/editor/bracketmatching/DefaultBracePairProvider.xtend rename org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/editor/bracketmatching/{IBracePairProvider.xtend => IBracePairProvider.java} (75%) rename org.eclipse.xtext.ide/{xtend-gen => src}/org/eclipse/xtext/ide/editor/bracketmatching/XtextBracePairProvider.java (65%) delete mode 100644 org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/editor/bracketmatching/XtextBracePairProvider.xtend rename org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/editor/navigation/{INavigatable.xtend => INavigatable.java} (57%) rename org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/server/{ICapabilitiesContributor.xtend => ICapabilitiesContributor.java} (62%) create mode 100644 org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/server/ILanguageServerAccess.java delete mode 100644 org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/server/ILanguageServerAccess.xtend create mode 100644 org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/server/ILanguageServerExtension.java delete mode 100644 org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/server/ILanguageServerExtension.xtend create mode 100644 org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/server/ServerModule.java delete mode 100644 org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/server/ServerModule.xtend create mode 100644 org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/server/codeActions/ICodeActionService2.java delete mode 100644 org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/server/codeActions/ICodeActionService2.xtend rename org.eclipse.xtext.ide/{xtend-gen => src}/org/eclipse/xtext/ide/server/codelens/ICodeLensResolver.java (57%) delete mode 100644 org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/server/codelens/ICodeLensResolver.xtend rename org.eclipse.xtext.ide/{xtend-gen => src}/org/eclipse/xtext/ide/server/codelens/ICodeLensService.java (57%) delete mode 100644 org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/server/codelens/ICodeLensService.xtend rename org.eclipse.xtext.ide/{xtend-gen => src}/org/eclipse/xtext/ide/server/commands/IExecutableCommandService.java (79%) delete mode 100644 org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/server/commands/IExecutableCommandService.xtend create mode 100644 org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/server/hover/HoverContext.java rename org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/server/semanticHighlight/{ISemanticHighlightingStyleToTokenMapper.xtend => ISemanticHighlightingStyleToTokenMapper.java} (56%) create mode 100644 org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/util/CancelIndicatorProgressMonitor.java delete mode 100644 org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/util/CancelIndicatorProgressMonitor.xtend delete mode 100644 org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/editor/bracketmatching/BracePair.java delete mode 100644 org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/editor/bracketmatching/DefaultBracePairProvider.java delete mode 100644 org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/editor/bracketmatching/IBracePairProvider.java delete mode 100644 org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/editor/navigation/INavigatable.java delete mode 100644 org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/server/ICapabilitiesContributor.java delete mode 100644 org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/server/ILanguageServerAccess.java delete mode 100644 org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/server/ILanguageServerExtension.java delete mode 100644 org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/server/ServerModule.java delete mode 100644 org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/server/codeActions/ICodeActionService2.java delete mode 100644 org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/server/hover/HoverContext.java delete mode 100644 org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/server/semanticHighlight/ISemanticHighlightingStyleToTokenMapper.java delete mode 100644 org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/util/CancelIndicatorProgressMonitor.java diff --git a/org.eclipse.xtext.ide.tests/xtend-gen/org/eclipse/xtext/ide/tests/testlanguage/ide/TestLangLSPExtension.java b/org.eclipse.xtext.ide.tests/xtend-gen/org/eclipse/xtext/ide/tests/testlanguage/ide/TestLangLSPExtension.java index 2d4feeddb..6a6769055 100644 --- a/org.eclipse.xtext.ide.tests/xtend-gen/org/eclipse/xtext/ide/tests/testlanguage/ide/TestLangLSPExtension.java +++ b/org.eclipse.xtext.ide.tests/xtend-gen/org/eclipse/xtext/ide/tests/testlanguage/ide/TestLangLSPExtension.java @@ -26,6 +26,7 @@ import org.eclipse.lsp4j.jsonrpc.services.JsonRequest; import org.eclipse.lsp4j.jsonrpc.services.ServiceEndpoints; import org.eclipse.lsp4j.services.LanguageClient; import org.eclipse.xtend.lib.annotations.ToString; +import org.eclipse.xtext.ide.server.Document; import org.eclipse.xtext.ide.server.ILanguageServerAccess; import org.eclipse.xtext.ide.server.ILanguageServerExtension; import org.eclipse.xtext.ide.tests.testlanguage.testLanguage.TestLanguagePackage; @@ -82,10 +83,12 @@ public interface TestLangLSPExtension extends ILanguageServerExtension { @Override public CompletableFuture getTextOfLine(final TestLangLSPExtension.TextOfLineParam param) { final Function _function = (ILanguageServerAccess.Context ctx) -> { + Document _document = ctx.getDocument(); Position _position = new Position(param.line, 0); - final int start = ctx.getDocument().getOffSet(_position); + final int start = _document.getOffSet(_position); + Document _document_1 = ctx.getDocument(); Position _position_1 = new Position((param.line + 1), 0); - int _offSet = ctx.getDocument().getOffSet(_position_1); + int _offSet = _document_1.getOffSet(_position_1); int _length = System.lineSeparator().length(); final int end = (_offSet - _length); TestLangLSPExtension.TextOfLineResult _textOfLineResult = new TestLangLSPExtension.TextOfLineResult(); diff --git a/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/DefaultIdeModule.java b/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/DefaultIdeModule.java similarity index 55% rename from org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/DefaultIdeModule.java rename to org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/DefaultIdeModule.java index 5fc6aadb0..9cc145dbf 100644 --- a/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/DefaultIdeModule.java +++ b/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/DefaultIdeModule.java @@ -1,17 +1,16 @@ -/** - * Copyright (c) 2016, 2017 TypeFox GmbH (http://www.typefox.io) and others. +/******************************************************************************* + * Copyright (c) 2016, 2020 TypeFox GmbH (http://www.typefox.io) and others. * This program and the accompanying materials are made available under the * terms of the Eclipse Public License 2.0 which is available at * http://www.eclipse.org/legal/epl-2.0. - * + * * SPDX-License-Identifier: EPL-2.0 - */ + *******************************************************************************/ package org.eclipse.xtext.ide; import com.google.inject.Binder; import com.google.inject.name.Names; import java.util.concurrent.ExecutorService; -import org.eclipse.xtext.ide.ExecutorServiceProvider; import org.eclipse.xtext.resource.IResourceDescriptions; import org.eclipse.xtext.resource.impl.LiveShadowedChunkedResourceDescriptions; import org.eclipse.xtext.resource.impl.ResourceDescriptionsProvider; @@ -22,17 +21,18 @@ import org.eclipse.xtext.workspace.ProjectConfigProvider; /** * Default Guice bindings for the generic IDE features of Xtext. */ -@SuppressWarnings("all") public class DefaultIdeModule extends AbstractGenericModule { - public void configureExecutorService(final Binder binder) { - binder.bind(ExecutorService.class).toProvider(ExecutorServiceProvider.class); - } - - public void configureIResourceDescriptionsLiveScope(final Binder binder) { - binder.bind(IResourceDescriptions.class).annotatedWith(Names.named(ResourceDescriptionsProvider.LIVE_SCOPE)).to(LiveShadowedChunkedResourceDescriptions.class); - } - - public Class bindIProjectConfigProvider() { - return ProjectConfigProvider.class; - } + + public void configureExecutorService(Binder binder) { + binder.bind(ExecutorService.class).toProvider(ExecutorServiceProvider.class); + } + + public void configureIResourceDescriptionsLiveScope(Binder binder) { + binder.bind(IResourceDescriptions.class).annotatedWith(Names.named(ResourceDescriptionsProvider.LIVE_SCOPE)) + .to(LiveShadowedChunkedResourceDescriptions.class); + } + + public Class bindIProjectConfigProvider() { + return ProjectConfigProvider.class; + } } diff --git a/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/DefaultIdeModule.xtend b/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/DefaultIdeModule.xtend deleted file mode 100644 index c76bcb182..000000000 --- a/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/DefaultIdeModule.xtend +++ /dev/null @@ -1,39 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2016, 2017 TypeFox GmbH (http://www.typefox.io) and others. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0. - * - * SPDX-License-Identifier: EPL-2.0 - *******************************************************************************/ -package org.eclipse.xtext.ide - -import com.google.inject.Binder -import com.google.inject.name.Names -import java.util.concurrent.ExecutorService -import org.eclipse.xtext.resource.IResourceDescriptions -import org.eclipse.xtext.resource.impl.LiveShadowedChunkedResourceDescriptions -import org.eclipse.xtext.resource.impl.ResourceDescriptionsProvider -import org.eclipse.xtext.service.AbstractGenericModule -import org.eclipse.xtext.workspace.IProjectConfigProvider -import org.eclipse.xtext.workspace.ProjectConfigProvider - -/** - * Default Guice bindings for the generic IDE features of Xtext. - */ -class DefaultIdeModule extends AbstractGenericModule { - - def void configureExecutorService(Binder binder) { - binder.bind(ExecutorService).toProvider(ExecutorServiceProvider) - } - - def void configureIResourceDescriptionsLiveScope(Binder binder) { - binder.bind(IResourceDescriptions) - .annotatedWith(Names.named(ResourceDescriptionsProvider.LIVE_SCOPE)) - .to(LiveShadowedChunkedResourceDescriptions); - } - - def Class bindIProjectConfigProvider() { - ProjectConfigProvider - } -} diff --git a/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/editor/bracketmatching/BracePair.java b/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/editor/bracketmatching/BracePair.java new file mode 100644 index 000000000..1ad6429f6 --- /dev/null +++ b/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/editor/bracketmatching/BracePair.java @@ -0,0 +1,103 @@ +/** + * Copyright (c) 2015, 2020 itemis AG (http://www.itemis.eu) and others. + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * SPDX-License-Identifier: EPL-2.0 + */ +package org.eclipse.xtext.ide.editor.bracketmatching; + +import org.eclipse.xtext.xbase.lib.util.ToStringBuilder; + +import com.google.common.base.Preconditions; + +/** + * Defines a single pair of braces which need to be matched when editing code. + * + * @author kosyakov - Initial contribution and API + */ +public class BracePair { + /** + * The length of a left brace should be one character for Eclipse. + */ + private final String leftBrace; + + /** + * The length of a right brace should be one character for Eclipse. + */ + private final String rightBrace; + + /** + * True if the brace is structural. Structural braces have higher priority than regular braces: they are matched + * with each other even if there are unmatched braces of other types between them. An opening non-structural + * brace is not matched with a closing one if one of them is outside a pair of matched structural braces and another + * is inside. In Java code, the curly braces are structural. + * + * It is ignored by Eclipse. + */ + private final boolean structural; + + public BracePair(String leftBrace, String rightBrace, boolean structural) { + Preconditions.checkArgument(leftBrace.length() == 1); + Preconditions.checkArgument(rightBrace.length() == 1); + this.leftBrace = leftBrace; + this.rightBrace = rightBrace; + this.structural = structural; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + (leftBrace == null ? 0 : leftBrace.hashCode()); + result = prime * result + (rightBrace == null ? 0 : rightBrace.hashCode()); + result = prime * result + (structural ? 1231 : 1237); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + BracePair other = (BracePair) obj; + if (leftBrace == null) { + if (other.leftBrace != null) + return false; + } else if (!leftBrace.equals(other.leftBrace)) + return false; + if (rightBrace == null) { + if (other.rightBrace != null) + return false; + } else if (!rightBrace.equals(other.rightBrace)) + return false; + if (structural != other.structural) + return false; + return true; + } + + @Override + public String toString() { + ToStringBuilder b = new ToStringBuilder(this); + b.add("leftBrace", this.leftBrace); + b.add("rightBrace", this.rightBrace); + b.add("structural", this.structural); + return b.toString(); + } + + public String getLeftBrace() { + return leftBrace; + } + + public String getRightBrace() { + return rightBrace; + } + + public boolean isStructural() { + return structural; + } +} diff --git a/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/editor/bracketmatching/BracePair.xtend b/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/editor/bracketmatching/BracePair.xtend deleted file mode 100644 index e9db8b623..000000000 --- a/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/editor/bracketmatching/BracePair.xtend +++ /dev/null @@ -1,37 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 itemis AG (http://www.itemis.eu) and others. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0. - * - * SPDX-License-Identifier: EPL-2.0 - *******************************************************************************/ -package org.eclipse.xtext.ide.editor.bracketmatching - -import org.eclipse.xtend.lib.annotations.Data - -/** - * Defines a single pair of braces which need to be matched when editing code. - * - * @author kosyakov - Initial contribution and API - */ -@Data -class BracePair { - /** - * The length of a left brace should be one character for Eclipse. - */ - val String leftBrace - /** - * The length of a right brace should be one character for Eclipse. - */ - val String rightBrace - /** - * True if the brace is structural. Structural braces have higher priority than regular braces: - * they are matched with each other even if there are unmatched braces of other types between them, - * and an opening non-structural brace is not matched with a closing one if one of them is outside a pair - * of matched structural braces and another is outside. In Java code, the curly braces are structural. - * - * It is ignored by Eclipse. - */ - val boolean structural -} \ No newline at end of file diff --git a/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/editor/bracketmatching/DefaultBracePairProvider.java b/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/editor/bracketmatching/DefaultBracePairProvider.java new file mode 100644 index 000000000..adfbff581 --- /dev/null +++ b/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/editor/bracketmatching/DefaultBracePairProvider.java @@ -0,0 +1,37 @@ +/** + * Copyright (c) 2015, 2020 itemis AG (http://www.itemis.eu) and others. + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * SPDX-License-Identifier: EPL-2.0 + */ +package org.eclipse.xtext.ide.editor.bracketmatching; + +import java.util.Collections; +import java.util.Set; + +import org.eclipse.xtext.xbase.lib.CollectionLiterals; + +import com.google.inject.Singleton; + +/** + * @author kosyakov - Initial contribution and API + */ +@Singleton +public class DefaultBracePairProvider implements IBracePairProvider { + private final Set pairs; + + public DefaultBracePairProvider() { + this(Collections.unmodifiableSet(CollectionLiterals.newHashSet(new BracePair("(", ")", true), + new BracePair("{", "}", true), new BracePair("[", "]", true)))); + } + + public DefaultBracePairProvider(Set pairs) { + this.pairs = pairs; + } + + public Set getPairs() { + return pairs; + } +} diff --git a/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/editor/bracketmatching/DefaultBracePairProvider.xtend b/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/editor/bracketmatching/DefaultBracePairProvider.xtend deleted file mode 100644 index 7f6291cdb..000000000 --- a/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/editor/bracketmatching/DefaultBracePairProvider.xtend +++ /dev/null @@ -1,34 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 itemis AG (http://www.itemis.eu) and others. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0. - * - * SPDX-License-Identifier: EPL-2.0 - *******************************************************************************/ -package org.eclipse.xtext.ide.editor.bracketmatching - -import com.google.inject.Singleton -import java.util.Set -import org.eclipse.xtend.lib.annotations.Accessors -import org.eclipse.xtend.lib.annotations.FinalFieldsConstructor - -/** - * @author kosyakov - Initial contribution and API - */ -@Singleton -@Accessors -@FinalFieldsConstructor -class DefaultBracePairProvider implements IBracePairProvider { - - val Set pairs - - new() { - this(#{ - new BracePair("(", ")", true), - new BracePair("{", "}", true), - new BracePair("[", "]", true) - }) - } - -} \ No newline at end of file diff --git a/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/editor/bracketmatching/IBracePairProvider.xtend b/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/editor/bracketmatching/IBracePairProvider.java similarity index 75% rename from org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/editor/bracketmatching/IBracePairProvider.xtend rename to org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/editor/bracketmatching/IBracePairProvider.java index b31b88edf..b6248a23b 100644 --- a/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/editor/bracketmatching/IBracePairProvider.xtend +++ b/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/editor/bracketmatching/IBracePairProvider.java @@ -1,14 +1,14 @@ /******************************************************************************* - * Copyright (c) 2015 itemis AG (http://www.itemis.eu) and others. + * Copyright (c) 2015, 2020 itemis AG (http://www.itemis.eu) and others. * This program and the accompanying materials are made available under the * terms of the Eclipse Public License 2.0 which is available at * http://www.eclipse.org/legal/epl-2.0. * * SPDX-License-Identifier: EPL-2.0 *******************************************************************************/ -package org.eclipse.xtext.ide.editor.bracketmatching +package org.eclipse.xtext.ide.editor.bracketmatching; -import java.util.Set +import java.util.Set; /** *

@@ -18,12 +18,12 @@ import java.util.Set * * @author kosyakov - Initial contribution and API */ -interface IBracePairProvider { +public interface IBracePairProvider { /** * Returns a set of definitions for brace pairs that need to be matched when * editing code. */ - def Set getPairs() + Set getPairs(); } \ No newline at end of file diff --git a/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/editor/bracketmatching/XtextBracePairProvider.java b/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/editor/bracketmatching/XtextBracePairProvider.java similarity index 65% rename from org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/editor/bracketmatching/XtextBracePairProvider.java rename to org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/editor/bracketmatching/XtextBracePairProvider.java index 5ec513848..34ccbd23e 100644 --- a/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/editor/bracketmatching/XtextBracePairProvider.java +++ b/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/editor/bracketmatching/XtextBracePairProvider.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2015 itemis AG (http://www.itemis.eu) and others. + * Copyright (c) 2015, 2020 itemis AG (http://www.itemis.eu) and others. * This program and the accompanying materials are made available under the * terms of the Eclipse Public License 2.0 which is available at * http://www.eclipse.org/legal/epl-2.0. @@ -18,10 +18,9 @@ import org.eclipse.xtext.xbase.lib.CollectionLiterals; * @author kosyakov - Initial contribution and API */ @Singleton -@SuppressWarnings("all") public class XtextBracePairProvider extends DefaultBracePairProvider { - public XtextBracePairProvider() { - super( - Collections.unmodifiableSet(CollectionLiterals.newHashSet(new BracePair(":", ";", true), new BracePair("(", ")", false), new BracePair("{", "}", true), new BracePair("[", "]", false)))); - } + public XtextBracePairProvider() { + super(Collections.unmodifiableSet(CollectionLiterals.newHashSet(new BracePair(":", ";", true), + new BracePair("(", ")", false), new BracePair("{", "}", true), new BracePair("[", "]", false)))); + } } diff --git a/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/editor/bracketmatching/XtextBracePairProvider.xtend b/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/editor/bracketmatching/XtextBracePairProvider.xtend deleted file mode 100644 index 0f363d343..000000000 --- a/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/editor/bracketmatching/XtextBracePairProvider.xtend +++ /dev/null @@ -1,26 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 itemis AG (http://www.itemis.eu) and others. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0. - * - * SPDX-License-Identifier: EPL-2.0 - *******************************************************************************/ -package org.eclipse.xtext.ide.editor.bracketmatching - -import com.google.inject.Singleton - -/** - * @author kosyakov - Initial contribution and API - */ -@Singleton -class XtextBracePairProvider extends DefaultBracePairProvider { - new() { - super(#{ - new BracePair(":", ";", true), - new BracePair("(", ")", false), - new BracePair("{", "}", true), - new BracePair("[", "]", false) - }) - } -} \ No newline at end of file diff --git a/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/editor/navigation/INavigatable.xtend b/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/editor/navigation/INavigatable.java similarity index 57% rename from org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/editor/navigation/INavigatable.xtend rename to org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/editor/navigation/INavigatable.java index d88bab830..46a04f821 100644 --- a/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/editor/navigation/INavigatable.xtend +++ b/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/editor/navigation/INavigatable.java @@ -1,12 +1,12 @@ -/******************************************************************************* - * Copyright (c) 2016 TypeFox GmbH (http://www.typefox.io) and others. +/** + * Copyright (c) 2016, 2020 TypeFox GmbH (http://www.typefox.io) and others. * This program and the accompanying materials are made available under the * terms of the Eclipse Public License 2.0 which is available at * http://www.eclipse.org/legal/epl-2.0. - * + * * SPDX-License-Identifier: EPL-2.0 - *******************************************************************************/ -package org.eclipse.xtext.ide.editor.navigation + */ +package org.eclipse.xtext.ide.editor.navigation; /** * Represents an instance that can be opened in an editor. @@ -14,18 +14,18 @@ package org.eclipse.xtext.ide.editor.navigation * @author kosyakov - Initial contribution and API * @since 2.10 */ -interface INavigatable { - +public interface INavigatable { /** *

- * Returns an instance containing enough information to identify an editor that should be opened and a region that should be revealed. + * Returns an instance containing enough information to identify an editor that should be opened and a region that + * should be revealed. *

*

- * Typical navigation elements are resource, object and reference descriptions as well as another navigatable element. + * Typical navigation elements are resource, object and reference descriptions. *

*

* Avoid usage of resource sets, resources and eobjects as navigation elements, since it can lead to memory leaks. - *

+ *

*/ - def Object getNavigationElement() + Object getNavigationElement(); } diff --git a/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/server/ICapabilitiesContributor.xtend b/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/server/ICapabilitiesContributor.java similarity index 62% rename from org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/server/ICapabilitiesContributor.xtend rename to org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/server/ICapabilitiesContributor.java index f5168995f..26dfadd25 100644 --- a/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/server/ICapabilitiesContributor.xtend +++ b/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/server/ICapabilitiesContributor.java @@ -1,23 +1,23 @@ /******************************************************************************* - * Copyright (c) 2017 TypeFox GmbH (http://www.typefox.io) and others. + * Copyright (c) 2017, 2020 TypeFox GmbH (http://www.typefox.io) and others. * This program and the accompanying materials are made available under the * terms of the Eclipse Public License 2.0 which is available at * http://www.eclipse.org/legal/epl-2.0. * * SPDX-License-Identifier: EPL-2.0 *******************************************************************************/ -package org.eclipse.xtext.ide.server +package org.eclipse.xtext.ide.server; -import org.eclipse.lsp4j.ServerCapabilities -import org.eclipse.lsp4j.InitializeParams +import org.eclipse.lsp4j.ServerCapabilities; +import org.eclipse.lsp4j.InitializeParams; /** * @author Sven Efftinge - Initial contribution and API */ -interface ICapabilitiesContributor { +public interface ICapabilitiesContributor { /** * Allows an individual language to contribute to and overwrite properties in the server's capabilities. */ - def ServerCapabilities contribute(ServerCapabilities capabilities, InitializeParams params); + ServerCapabilities contribute(ServerCapabilities capabilities, InitializeParams params); } \ No newline at end of file diff --git a/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/server/ILanguageServerAccess.java b/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/server/ILanguageServerAccess.java new file mode 100644 index 000000000..b7278dcca --- /dev/null +++ b/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/server/ILanguageServerAccess.java @@ -0,0 +1,166 @@ +/** + * Copyright (c) 2016, 2020 TypeFox GmbH (http://www.typefox.io) and others. + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * SPDX-License-Identifier: EPL-2.0 + */ +package org.eclipse.xtext.ide.server; + +import java.util.List; +import java.util.concurrent.CompletableFuture; +import java.util.function.Function; + +import org.eclipse.emf.common.util.URI; +import org.eclipse.emf.ecore.resource.Resource; +import org.eclipse.emf.ecore.resource.ResourceSet; +import org.eclipse.lsp4j.InitializeParams; +import org.eclipse.lsp4j.InitializeResult; +import org.eclipse.lsp4j.jsonrpc.Endpoint; +import org.eclipse.lsp4j.services.LanguageClient; +import org.eclipse.xtext.ide.serializer.IChangeSerializer; +import org.eclipse.xtext.resource.IResourceDescription; +import org.eclipse.xtext.resource.IResourceDescriptions; +import org.eclipse.xtext.resource.impl.ResourceDescriptionsProvider; +import org.eclipse.xtext.util.CancelIndicator; +import org.eclipse.xtext.xbase.lib.util.ToStringBuilder; + +/** + * API for interacting with a running language server. + * + * @author Sven Efftinge - Initial contribution and API + */ +public interface ILanguageServerAccess { + class Context { + private final Resource resource; + + private final Document document; + + private final boolean isDocumentOpen; + + private final CancelIndicator cancelChecker; + + public Context(Resource resource, Document document, boolean isDocumentOpen, CancelIndicator cancelChecker) { + this.resource = resource; + this.document = document; + this.isDocumentOpen = isDocumentOpen; + this.cancelChecker = cancelChecker; + } + + @Override + public String toString() { + ToStringBuilder b = new ToStringBuilder(this); + b.add("resource", resource); + b.add("document", document); + b.add("isDocumentOpen", isDocumentOpen); + b.add("cancelChecker", cancelChecker); + return b.toString(); + } + + public Resource getResource() { + return resource; + } + + public Document getDocument() { + return document; + } + + public boolean isDocumentOpen() { + return isDocumentOpen; + } + + public CancelIndicator getCancelChecker() { + return cancelChecker; + } + } + + class IndexContext { + private final IResourceDescriptions index; + + private final CancelIndicator cancelChecker; + + public IndexContext(IResourceDescriptions index, CancelIndicator cancelChecker) { + this.index = index; + this.cancelChecker = cancelChecker; + } + + @Override + public String toString() { + ToStringBuilder b = new ToStringBuilder(this); + b.add("index", index); + b.add("cancelChecker", cancelChecker); + return b.toString(); + } + + public IResourceDescriptions getIndex() { + return index; + } + + public CancelIndicator getCancelChecker() { + return cancelChecker; + } + } + + interface IBuildListener { + void afterBuild(List deltas); + } + + /** + * Provides read access to a fully resolved resource and document. + */ + CompletableFuture doRead(String uri, Function function); + + /** + * Provides read access to the Xtext index. + * + * @since 2.18 + */ + CompletableFuture doReadIndex( + Function function); + + /** + * Registers a build listener on this language server + */ + void addBuildListener(ILanguageServerAccess.IBuildListener listener); + + /** + * Removes a build listener on this language server + */ + default void removeBuildListener(ILanguageServerAccess.IBuildListener listener) { + + } + + /** + * @return the language client facade. It usually also implements {@link Endpoint}, which can be used to call non-standard + * extensions to LSP. + */ + LanguageClient getLanguageClient(); + + /** + * Creates a new {@link ResourceSet} to be used with the {@link IChangeSerializer} API. + * + * The {@link IChangeSerializer} allows to calculate text edits from model changes. In order not to mess up the + * originals, the respective models should be loaded into a new resource set which this method provides. + * + * @param uri + * a file {@link URI} used to detect the project to configure the scope of the resource set. + * @return a new empty resource set, configured with the project the uri belongs to and the + * {@link ResourceDescriptionsProvider#LIVE_SCOPE} in order to reflect model changes immediately. + * @since 2.18 + */ + ResourceSet newLiveScopeResourceSet(URI uri); + + /** + * @return the parameters as negotiated during client and server on initialization. + * @since 2.18 + */ + InitializeParams getInitializeParams(); + + /** + * Returns the {@link InitializeResult} of the language server. + * + * @since 2.18 + */ + InitializeResult getInitializeResult(); +} diff --git a/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/server/ILanguageServerAccess.xtend b/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/server/ILanguageServerAccess.xtend deleted file mode 100644 index db4f67099..000000000 --- a/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/server/ILanguageServerAccess.xtend +++ /dev/null @@ -1,104 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2016 TypeFox GmbH (http://www.typefox.io) and others. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0. - * - * SPDX-License-Identifier: EPL-2.0 - *******************************************************************************/ -package org.eclipse.xtext.ide.server - -import java.util.List -import java.util.concurrent.CompletableFuture -import java.util.function.Function -import org.eclipse.emf.common.util.URI -import org.eclipse.emf.ecore.resource.Resource -import org.eclipse.emf.ecore.resource.ResourceSet -import org.eclipse.lsp4j.InitializeParams -import org.eclipse.lsp4j.InitializeResult -import org.eclipse.lsp4j.services.LanguageClient -import org.eclipse.xtend.lib.annotations.Data -import org.eclipse.xtext.ide.serializer.IChangeSerializer -import org.eclipse.xtext.resource.IResourceDescription -import org.eclipse.xtext.resource.IResourceDescriptions -import org.eclipse.xtext.resource.impl.ResourceDescriptionsProvider -import org.eclipse.xtext.util.CancelIndicator - -/** - * API for interacting with a running language server. - * - * @author Sven Efftinge - Initial contribution and API - */ -interface ILanguageServerAccess { - - @Data - static class Context { - Resource resource - Document document - boolean isDocumentOpen - CancelIndicator cancelChecker - } - - @Data - static class IndexContext { - IResourceDescriptions index - CancelIndicator cancelChecker - } - - /** - * provides read access to a fully resolved resource and Document. - */ - def CompletableFuture doRead(String uri, Function function) - - /** - * Provides read access to the Xtext index. - * - * @since 2.18 - */ - def CompletableFuture doReadIndex(Function function) - - static interface IBuildListener { - def void afterBuild(List deltas) - } - - /** - * registers a build listener on the this language server - */ - def void addBuildListener(IBuildListener listener) - - /** - * @return the language client facade. It usually also implements Endpoint, which can be used to - * call non-standard extensions to the LSP. - */ - def LanguageClient getLanguageClient(); - - /** - * Creates a new {@link ResourceSet} to be used with the {@link IChangeSerializer} API. - * - * The {@link IChangeSerializer} allows to calculate text edits from model changes. - * In order not to mess up the originals, the resp. models should be loaded into a - * new resource set which this method provides. - * - * @param uri a file URI used to detect the project to configure the scope of the resource set. - * @return a new empty resource set, configured with the project the uri - * belongs to and the {@link ResourceDescriptionsProvider#LIVE_SCOPE} in order to - * reflect model changes immediately. - * @since 2.18 - */ - def ResourceSet newLiveScopeResourceSet(URI uri); - - /** - * @return the parameters as negotiated during client and server on initialization. - * @since 2.18 - */ - def InitializeParams getInitializeParams(); - - /** - * Returns with the {@link InitializeResult} of the LS. - * - * @since 2.18 - */ - def InitializeResult getInitializeResult(); - - -} diff --git a/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/server/ILanguageServerExtension.java b/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/server/ILanguageServerExtension.java new file mode 100644 index 000000000..24b33898e --- /dev/null +++ b/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/server/ILanguageServerExtension.java @@ -0,0 +1,33 @@ +/** + * Copyright (c) 2016 TypeFox GmbH (http://www.typefox.io) and others. + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * SPDX-License-Identifier: EPL-2.0 + */ +package org.eclipse.xtext.ide.server; + +import org.eclipse.xtext.ide.server.ILanguageServerAccess; + +/** + * Interface for language specific extensions to LSP. Implementors should use {@link JsonRpcNotification} and {@link + * JsonRpcRequest} annotations. + * + * @author Sven Efftinge - Initial contribution and API + */ +public interface ILanguageServerExtension { + /** + * The same jsonrpc method might be supported by multiple languages and only the actual invocation might reveal is a + * language wants to handle it, based on e.g. a uri in the parameter. + * + * To indicate that a request is not handled, this exception should be thrown by the service. + */ + static final RuntimeException NOT_HANDLED_EXCEPTION = new UnsupportedOperationException("not handled"); + + /** + * Initialize the extension. + * @param access Provides access to language server documents, resource and build events. + */ + void initialize(ILanguageServerAccess access); +} diff --git a/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/server/ILanguageServerExtension.xtend b/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/server/ILanguageServerExtension.xtend deleted file mode 100644 index 9a89b5d8b..000000000 --- a/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/server/ILanguageServerExtension.xtend +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2016 TypeFox GmbH (http://www.typefox.io) and others. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0. - * - * SPDX-License-Identifier: EPL-2.0 - *******************************************************************************/ -package org.eclipse.xtext.ide.server - -/** - * Interface for language specific extensions to the LSP. - * Implementors should use {link JsonRpcNotification} and {link JsonRpcRequest} annotations. - * - * @author Sven Efftinge - Initial contribution and API - */ -interface ILanguageServerExtension { - - /** - * The same jsonrpc method might be supported by multiple languages and only the actual invocation - * might reveal is a language wants to handle it, based on e.g. a uri in the parameter. - * - * To indicate that a request is not handled, this exception should be thrown by the service. - */ - static RuntimeException NOT_HANDLED_EXCEPTION = new UnsupportedOperationException("not handled"); - - /** - * the language server provides a access to language server documents, resources and build events. - */ - def void initialize(ILanguageServerAccess access); -} \ No newline at end of file diff --git a/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/server/LanguageServerImpl.java b/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/server/LanguageServerImpl.java index 75989f5ed..c2a80a977 100644 --- a/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/server/LanguageServerImpl.java +++ b/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/server/LanguageServerImpl.java @@ -1099,6 +1099,11 @@ public class LanguageServerImpl implements LanguageServer, WorkspaceService, Tex public void addBuildListener(ILanguageServerAccess.IBuildListener listener) { workspaceManager.addBuildListener(listener); } + + @Override + public void removeBuildListener(ILanguageServerAccess.IBuildListener listener) { + workspaceManager.removeBuildListener(listener); + } @Override public LanguageClient getLanguageClient() { diff --git a/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/server/ServerModule.java b/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/server/ServerModule.java new file mode 100644 index 000000000..1112e86db --- /dev/null +++ b/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/server/ServerModule.java @@ -0,0 +1,37 @@ +/******************************************************************************* + * Copyright (c) 2016 TypeFox GmbH (http://www.typefox.io) and others. + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * SPDX-License-Identifier: EPL-2.0 + *******************************************************************************/ +package org.eclipse.xtext.ide.server; + +import com.google.inject.AbstractModule; +import java.util.concurrent.ExecutorService; +import org.eclipse.lsp4j.services.LanguageServer; +import org.eclipse.xtext.ide.ExecutorServiceProvider; +import org.eclipse.xtext.resource.IContainer; +import org.eclipse.xtext.resource.IResourceServiceProvider; +import org.eclipse.xtext.resource.ResourceServiceProviderServiceLoader; +import org.eclipse.xtext.resource.containers.ProjectDescriptionBasedContainerManager; + +/** + * @author Sven Efftinge - Initial contribution and API + * @since 2.11 + */ +public class ServerModule extends AbstractModule { + + @Override + protected void configure() { + binder().bind(ExecutorService.class).toProvider(ExecutorServiceProvider.class); + + bind(LanguageServer.class).to(LanguageServerImpl.class); + bind(IResourceServiceProvider.Registry.class).toProvider(ResourceServiceProviderServiceLoader.class); + bind(IWorkspaceConfigFactory.class).to(ProjectWorkspaceConfigFactory.class); + bind(ProjectWorkspaceConfigFactory.class).to(MultiRootWorkspaceConfigFactory.class); + bind(IProjectDescriptionFactory.class).to(DefaultProjectDescriptionFactory.class); + bind(IContainer.Manager.class).to(ProjectDescriptionBasedContainerManager.class); + } +} \ No newline at end of file diff --git a/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/server/ServerModule.xtend b/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/server/ServerModule.xtend deleted file mode 100644 index 1b6d10cc2..000000000 --- a/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/server/ServerModule.xtend +++ /dev/null @@ -1,36 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2016 TypeFox GmbH (http://www.typefox.io) and others. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0. - * - * SPDX-License-Identifier: EPL-2.0 - *******************************************************************************/ -package org.eclipse.xtext.ide.server - -import com.google.inject.AbstractModule -import java.util.concurrent.ExecutorService -import org.eclipse.lsp4j.services.LanguageServer -import org.eclipse.xtext.ide.ExecutorServiceProvider -import org.eclipse.xtext.resource.IContainer -import org.eclipse.xtext.resource.IResourceServiceProvider -import org.eclipse.xtext.resource.ResourceServiceProviderServiceLoader -import org.eclipse.xtext.resource.containers.ProjectDescriptionBasedContainerManager - -/** - * @author Sven Efftinge - Initial contribution and API - * @since 2.11 - */ -class ServerModule extends AbstractModule { - - override protected configure() { - binder.bind(ExecutorService).toProvider(ExecutorServiceProvider) - - bind(LanguageServer).to(LanguageServerImpl) - bind(IResourceServiceProvider.Registry).toProvider(ResourceServiceProviderServiceLoader) - bind(IWorkspaceConfigFactory).to(ProjectWorkspaceConfigFactory) - bind(ProjectWorkspaceConfigFactory).to(MultiRootWorkspaceConfigFactory) - bind(IProjectDescriptionFactory).to(DefaultProjectDescriptionFactory) - bind(IContainer.Manager).to(ProjectDescriptionBasedContainerManager) - } -} \ No newline at end of file diff --git a/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/server/codeActions/ICodeActionService2.java b/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/server/codeActions/ICodeActionService2.java new file mode 100644 index 000000000..1df7dfbc2 --- /dev/null +++ b/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/server/codeActions/ICodeActionService2.java @@ -0,0 +1,80 @@ +/** + * Copyright (c) 2017, 2020 TypeFox GmbH (http://www.typefox.io) and others. + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * SPDX-License-Identifier: EPL-2.0 + */ +package org.eclipse.xtext.ide.server.codeActions; + +import java.util.List; + +import org.eclipse.lsp4j.CodeAction; +import org.eclipse.lsp4j.CodeActionParams; +import org.eclipse.lsp4j.Command; +import org.eclipse.lsp4j.jsonrpc.messages.Either; +import org.eclipse.xtext.ide.server.Document; +import org.eclipse.xtext.ide.server.ILanguageServerAccess; +import org.eclipse.xtext.resource.XtextResource; +import org.eclipse.xtext.util.CancelIndicator; + +/** + * @author Jan Koehnlein + * @since 2.18 + */ +public interface ICodeActionService2 { + class Options { + private Document document; + + private XtextResource resource; + + private ILanguageServerAccess languageServerAccess; + + private CodeActionParams codeActionParams; + + private CancelIndicator cancelIndicator; + + public Document getDocument() { + return document; + } + + public void setDocument(Document document) { + this.document = document; + } + + public XtextResource getResource() { + return resource; + } + + public void setResource(XtextResource resource) { + this.resource = resource; + } + + public ILanguageServerAccess getLanguageServerAccess() { + return languageServerAccess; + } + + public void setLanguageServerAccess(ILanguageServerAccess languageServerAccess) { + this.languageServerAccess = languageServerAccess; + } + + public CodeActionParams getCodeActionParams() { + return codeActionParams; + } + + public void setCodeActionParams(CodeActionParams codeActionParams) { + this.codeActionParams = codeActionParams; + } + + public CancelIndicator getCancelIndicator() { + return this.cancelIndicator; + } + + public void setCancelIndicator(CancelIndicator cancelIndicator) { + this.cancelIndicator = cancelIndicator; + } + } + + List> getCodeActions(ICodeActionService2.Options options); +} diff --git a/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/server/codeActions/ICodeActionService2.xtend b/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/server/codeActions/ICodeActionService2.xtend deleted file mode 100644 index b52e51fd7..000000000 --- a/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/server/codeActions/ICodeActionService2.xtend +++ /dev/null @@ -1,39 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2017, 2020 TypeFox GmbH (http://www.typefox.io) and others. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0. - * - * SPDX-License-Identifier: EPL-2.0 - *******************************************************************************/ -package org.eclipse.xtext.ide.server.codeActions - -import java.util.List -import org.eclipse.lsp4j.CodeAction -import org.eclipse.lsp4j.CodeActionParams -import org.eclipse.lsp4j.Command -import org.eclipse.lsp4j.jsonrpc.messages.Either -import org.eclipse.xtend.lib.annotations.Accessors -import org.eclipse.xtext.ide.server.Document -import org.eclipse.xtext.ide.server.ILanguageServerAccess -import org.eclipse.xtext.resource.XtextResource -import org.eclipse.xtext.util.CancelIndicator - -/** - * @author Jan Koehnlein - * @since 2.18 - */ - interface ICodeActionService2 { - - def List> getCodeActions(Options options) - - @Accessors - class Options { - Document document - XtextResource resource - ILanguageServerAccess languageServerAccess - CodeActionParams codeActionParams - CancelIndicator cancelIndicator - } -} - \ No newline at end of file diff --git a/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/server/codelens/ICodeLensResolver.java b/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/server/codelens/ICodeLensResolver.java similarity index 57% rename from org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/server/codelens/ICodeLensResolver.java rename to org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/server/codelens/ICodeLensResolver.java index bd00a0b5c..17da0a54e 100644 --- a/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/server/codelens/ICodeLensResolver.java +++ b/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/server/codelens/ICodeLensResolver.java @@ -1,11 +1,11 @@ -/** - * Copyright (c) 2017 TypeFox GmbH (http://www.typefox.io) and others. +/******************************************************************************* + * Copyright (c) 2017, 2020 TypeFox GmbH (http://www.typefox.io) and others. * This program and the accompanying materials are made available under the * terms of the Eclipse Public License 2.0 which is available at * http://www.eclipse.org/legal/epl-2.0. - * + * * SPDX-License-Identifier: EPL-2.0 - */ + *******************************************************************************/ package org.eclipse.xtext.ide.server.codelens; import org.eclipse.lsp4j.CodeLens; @@ -16,10 +16,10 @@ import org.eclipse.xtext.util.CancelIndicator; /** * @author Sven Efftinge - Initial contribution and API */ -@SuppressWarnings("all") public interface ICodeLensResolver { - /** - * Resolve the given code lens. - */ - CodeLens resolveCodeLens(final Document document, final XtextResource resource, final CodeLens codeLens, final CancelIndicator indicator); + + /** + * Resolve the given code lens. + */ + CodeLens resolveCodeLens(Document document, XtextResource resource, CodeLens codeLens, CancelIndicator indicator); } diff --git a/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/server/codelens/ICodeLensResolver.xtend b/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/server/codelens/ICodeLensResolver.xtend deleted file mode 100644 index cbb114a53..000000000 --- a/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/server/codelens/ICodeLensResolver.xtend +++ /dev/null @@ -1,25 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2017 TypeFox GmbH (http://www.typefox.io) and others. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0. - * - * SPDX-License-Identifier: EPL-2.0 - *******************************************************************************/ -package org.eclipse.xtext.ide.server.codelens - -import org.eclipse.lsp4j.CodeLens -import org.eclipse.xtext.ide.server.Document -import org.eclipse.xtext.resource.XtextResource -import org.eclipse.xtext.util.CancelIndicator - -/** - * @author Sven Efftinge - Initial contribution and API - */ -interface ICodeLensResolver { - - /** - * Resolve the given code lens. - */ - def CodeLens resolveCodeLens(Document document, XtextResource resource, CodeLens codeLens, CancelIndicator indicator); -} \ No newline at end of file diff --git a/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/server/codelens/ICodeLensService.java b/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/server/codelens/ICodeLensService.java similarity index 57% rename from org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/server/codelens/ICodeLensService.java rename to org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/server/codelens/ICodeLensService.java index 7e77491ed..e1a924bdf 100644 --- a/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/server/codelens/ICodeLensService.java +++ b/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/server/codelens/ICodeLensService.java @@ -1,11 +1,11 @@ -/** - * Copyright (c) 2017 TypeFox GmbH (http://www.typefox.io) and others. +/******************************************************************************* + * Copyright (c) 2017, 2020 TypeFox GmbH (http://www.typefox.io) and others. * This program and the accompanying materials are made available under the * terms of the Eclipse Public License 2.0 which is available at * http://www.eclipse.org/legal/epl-2.0. - * + * * SPDX-License-Identifier: EPL-2.0 - */ + *******************************************************************************/ package org.eclipse.xtext.ide.server.codelens; import java.util.List; @@ -18,10 +18,11 @@ import org.eclipse.xtext.util.CancelIndicator; /** * @author Sven Efftinge - Initial contribution and API */ -@SuppressWarnings("all") public interface ICodeLensService { - /** - * compute code lenses for the given context. - */ - List computeCodeLenses(final Document document, final XtextResource resource, final CodeLensParams params, final CancelIndicator indicator); -} + + /** + * Compute code lenses for the given context. + */ + List computeCodeLenses(Document document, XtextResource resource, CodeLensParams params, CancelIndicator indicator); + +} \ No newline at end of file diff --git a/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/server/codelens/ICodeLensService.xtend b/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/server/codelens/ICodeLensService.xtend deleted file mode 100644 index ea7ca81c1..000000000 --- a/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/server/codelens/ICodeLensService.xtend +++ /dev/null @@ -1,28 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2017 TypeFox GmbH (http://www.typefox.io) and others. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0. - * - * SPDX-License-Identifier: EPL-2.0 - *******************************************************************************/ -package org.eclipse.xtext.ide.server.codelens - -import java.util.List -import org.eclipse.lsp4j.CodeLens -import org.eclipse.lsp4j.CodeLensParams -import org.eclipse.xtext.ide.server.Document -import org.eclipse.xtext.resource.XtextResource -import org.eclipse.xtext.util.CancelIndicator - -/** - * @author Sven Efftinge - Initial contribution and API - */ -interface ICodeLensService { - - /** - * compute code lenses for the given context. - */ - def List computeCodeLenses(Document document, XtextResource resource, CodeLensParams params, CancelIndicator indicator); - -} \ No newline at end of file diff --git a/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/server/commands/IExecutableCommandService.java b/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/server/commands/IExecutableCommandService.java similarity index 79% rename from org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/server/commands/IExecutableCommandService.java rename to org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/server/commands/IExecutableCommandService.java index 1aa109e5d..8f0bb7502 100644 --- a/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/server/commands/IExecutableCommandService.java +++ b/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/server/commands/IExecutableCommandService.java @@ -18,7 +18,6 @@ import org.eclipse.xtext.xbase.lib.Functions.Function1; /** * @author Sven Efftinge - Initial contribution and API */ -@SuppressWarnings("all") public interface IExecutableCommandService { /** * Called on server initialize. @@ -29,11 +28,11 @@ public interface IExecutableCommandService { /** * Called on server initialize, only if the client supported dynamicRegistration of commands. */ - default void initializeDynamicRegistration(final Function1 register) { + default void initializeDynamicRegistration(Function1 register) { } /** * Called when the client wants to execute a registered command. */ - Object execute(final ExecuteCommandParams params, final ILanguageServerAccess access, final CancelIndicator cancelIndicator); + Object execute(ExecuteCommandParams params, ILanguageServerAccess access, CancelIndicator cancelIndicator); } diff --git a/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/server/commands/IExecutableCommandService.xtend b/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/server/commands/IExecutableCommandService.xtend deleted file mode 100644 index 1bd942e58..000000000 --- a/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/server/commands/IExecutableCommandService.xtend +++ /dev/null @@ -1,37 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2017 TypeFox GmbH (http://www.typefox.io) and others. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0. - * - * SPDX-License-Identifier: EPL-2.0 - *******************************************************************************/ -package org.eclipse.xtext.ide.server.commands - -import java.util.List -import org.eclipse.lsp4j.ExecuteCommandParams -import org.eclipse.xtext.ide.server.ILanguageServerAccess -import org.eclipse.xtext.util.IDisposable -import org.eclipse.xtext.util.CancelIndicator - -/** - * @author Sven Efftinge - Initial contribution and API - */ -interface IExecutableCommandService { - - /** - * Called on server initialize. - * @return the supported commands - */ - def List initialize() - - /** - * Called on server initialize, only if the client supported dynamicRegistration of commands. - */ - def void initializeDynamicRegistration((String)=>IDisposable register) {} - - /** - * Called when the client wants to execute a registered command. - */ - def Object execute(ExecuteCommandParams params, ILanguageServerAccess access, CancelIndicator cancelIndicator) -} \ No newline at end of file diff --git a/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/server/hover/HoverContext.java b/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/server/hover/HoverContext.java new file mode 100644 index 000000000..7b695d4d4 --- /dev/null +++ b/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/server/hover/HoverContext.java @@ -0,0 +1,63 @@ +/** + * Copyright (c) 2016, 2020 TypeFox GmbH (http://www.typefox.io) and others. + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * SPDX-License-Identifier: EPL-2.0 + */ +package org.eclipse.xtext.ide.server.hover; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.util.EcoreUtil; +import org.eclipse.xtext.ide.server.Document; +import org.eclipse.xtext.resource.XtextResource; +import org.eclipse.xtext.util.ITextRegion; + +public class HoverContext { + private final Document document; + + private final XtextResource resource; + + private final int offset; + + private final ITextRegion region; + + private final EObject element; + + public HoverContext(Document document, XtextResource resource, int offset, ITextRegion region, EObject element) { + this.document = document; + this.resource = resource; + this.offset = offset; + this.region = region; + this.element = element; + } + + public Document getDocument() { + return document; + } + + public XtextResource getResource() { + return resource; + } + + public int getOffset() { + return offset; + } + + public ITextRegion getRegion() { + return region; + } + + public EObject getElement() { + return element; + } + + @Override + public String toString() { + return "HoverContext [document=" + document + ", resource=" + (resource == null ? "null" : resource.getURI()) + + ", offset=" + offset + ", region=" + region + ", element=" + + (element == null ? "null" : EcoreUtil.getURI(element)) + "]"; + } + +} diff --git a/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/server/hover/HoverService.xtend b/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/server/hover/HoverService.xtend index ec5c8ac15..53069938a 100644 --- a/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/server/hover/HoverService.xtend +++ b/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/server/hover/HoverService.xtend @@ -13,10 +13,9 @@ import com.google.inject.Inject import com.google.inject.Singleton import org.eclipse.emf.ecore.EObject import org.eclipse.lsp4j.Hover +import org.eclipse.lsp4j.HoverParams import org.eclipse.lsp4j.MarkupContent import org.eclipse.lsp4j.Range -import org.eclipse.xtend.lib.annotations.Accessors -import org.eclipse.xtend.lib.annotations.FinalFieldsConstructor import org.eclipse.xtext.documentation.IEObjectDocumentationProvider import org.eclipse.xtext.ide.server.Document import org.eclipse.xtext.ide.server.DocumentExtensions @@ -24,10 +23,8 @@ import org.eclipse.xtext.resource.EObjectAtOffsetHelper import org.eclipse.xtext.resource.ILocationInFileProvider import org.eclipse.xtext.resource.XtextResource import org.eclipse.xtext.util.CancelIndicator -import org.eclipse.xtext.util.ITextRegion import static extension org.eclipse.xtext.nodemodel.util.NodeModelUtils.* -import org.eclipse.lsp4j.HoverParams /** * @author kosyakov - Initial contribution and API @@ -124,13 +121,3 @@ class HoverService implements IHoverService { } } - -@Accessors -@FinalFieldsConstructor -class HoverContext { - val Document document - val XtextResource resource - val int offset - val ITextRegion region - val EObject element -} diff --git a/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/server/semanticHighlight/ISemanticHighlightingStyleToTokenMapper.xtend b/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/server/semanticHighlight/ISemanticHighlightingStyleToTokenMapper.java similarity index 56% rename from org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/server/semanticHighlight/ISemanticHighlightingStyleToTokenMapper.xtend rename to org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/server/semanticHighlight/ISemanticHighlightingStyleToTokenMapper.java index b8bb588e5..bffcf3ac9 100644 --- a/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/server/semanticHighlight/ISemanticHighlightingStyleToTokenMapper.xtend +++ b/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/server/semanticHighlight/ISemanticHighlightingStyleToTokenMapper.java @@ -1,46 +1,50 @@ /******************************************************************************* - * Copyright (c) 2018 TypeFox and others. + * Copyright (c) 2018, 2020 TypeFox and others. * This program and the accompanying materials are made available under the * terms of the Eclipse Public License 2.0 which is available at * http://www.eclipse.org/legal/epl-2.0. * * SPDX-License-Identifier: EPL-2.0 *******************************************************************************/ -package org.eclipse.xtext.ide.server.semanticHighlight +package org.eclipse.xtext.ide.server.semanticHighlight; -import com.google.inject.ImplementedBy -import com.google.inject.Singleton -import java.util.List -import java.util.Set -import org.eclipse.xtext.ide.editor.syntaxcoloring.IHighlightedPositionAcceptor -import org.eclipse.xtext.ide.editor.syntaxcoloring.ISemanticHighlightingCalculator -import org.eclipse.xtext.ide.editor.syntaxcoloring.LightweightPosition +import java.util.Collections; +import java.util.List; +import java.util.Set; + +import org.eclipse.xtext.ide.editor.syntaxcoloring.IHighlightedPositionAcceptor; +import org.eclipse.xtext.ide.editor.syntaxcoloring.ISemanticHighlightingCalculator; +import org.eclipse.xtext.ide.editor.syntaxcoloring.LightweightPosition; + +import com.google.inject.ImplementedBy; +import com.google.inject.Singleton; /** - * Service for mapping the IDs of the highlighting styles to a list of TextMate scopes. + * Service for mapping the IDs of the highlighting styles to a list of + * TextMate scopes. * * @see IHighlightedPositionAcceptor#addPosition * @see LightweightPosition#getIds * */ -@ImplementedBy(Noop) -interface ISemanticHighlightingStyleToTokenMapper { +@ImplementedBy(ISemanticHighlightingStyleToTokenMapper.Noop.class) +public interface ISemanticHighlightingStyleToTokenMapper { /** * Maps the highlighting style ID to the corresponding TextMate scopes. */ - def List toScopes(String styleId); + List toScopes(String styleId); /** - * Returns with a set of distinct style identifiers that are used by the {@link IHighlightedPositionAcceptor} when calculating - * the highlighted positions with the {@link ISemanticHighlightingCalculator}. + * Returns a set of distinct style identifiers that are used by the {@link IHighlightedPositionAcceptor} when + * calculating the highlighted positions with the {@link ISemanticHighlightingCalculator}. * *

* Must not return with {@code null} but an empty set instead. * * @see IHighlightedPositionAcceptor#addPosition */ - def Set getAllStyleIds(); + Set getAllStyleIds(); /** * The shared, default NOOP implementation of the semantic style ID to TextMate token mapper. @@ -48,12 +52,14 @@ interface ISemanticHighlightingStyleToTokenMapper { @Singleton static final class Noop implements ISemanticHighlightingStyleToTokenMapper { - override toScopes(String styleId) { + @Override + public List toScopes(String styleId) { return SemanticHighlightingRegistry.UNKNOWN_SCOPES; } - override getAllStyleIds() { - return emptySet; + @Override + public Set getAllStyleIds() { + return Collections.emptySet(); } } diff --git a/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/util/CancelIndicatorProgressMonitor.java b/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/util/CancelIndicatorProgressMonitor.java new file mode 100644 index 000000000..da9b938c4 --- /dev/null +++ b/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/util/CancelIndicatorProgressMonitor.java @@ -0,0 +1,60 @@ +/** + * Copyright (c) 2016, 2020 TypeFox GmbH (http://www.typefox.io) and others. + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * SPDX-License-Identifier: EPL-2.0 + */ +package org.eclipse.xtext.ide.util; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.xtext.util.CancelIndicator; + +/** + * @author kosyakov - Initial contribution and API + * @since 2.11 + */ +public class CancelIndicatorProgressMonitor implements IProgressMonitor { + private final CancelIndicator delegate; + + private volatile boolean canceled; + + @Override + public boolean isCanceled() { + return canceled || delegate.isCanceled(); + } + + @Override + public void setCanceled(boolean value) { + this.canceled = value; + } + + @Override + public void beginTask(String name, int totalWork) { + } + + @Override + public void setTaskName(String name) { + } + + @Override + public void subTask(String name) { + } + + @Override + public void internalWorked(double work) { + } + + @Override + public void worked(int work) { + } + + @Override + public void done() { + } + + public CancelIndicatorProgressMonitor(CancelIndicator delegate) { + this.delegate = delegate; + } +} diff --git a/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/util/CancelIndicatorProgressMonitor.xtend b/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/util/CancelIndicatorProgressMonitor.xtend deleted file mode 100644 index 60313636b..000000000 --- a/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/util/CancelIndicatorProgressMonitor.xtend +++ /dev/null @@ -1,52 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2016 TypeFox GmbH (http://www.typefox.io) and others. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0. - * - * SPDX-License-Identifier: EPL-2.0 - *******************************************************************************/ -package org.eclipse.xtext.ide.util - -import org.eclipse.core.runtime.IProgressMonitor -import org.eclipse.xtend.lib.annotations.FinalFieldsConstructor -import org.eclipse.xtext.util.CancelIndicator - -/** - * @author kosyakov - Initial contribution and API - * @since 2.11 - */ -@FinalFieldsConstructor -class CancelIndicatorProgressMonitor implements IProgressMonitor { - - val CancelIndicator delegate - - boolean canceled - - override isCanceled() { - canceled || delegate.isCanceled - } - - override setCanceled(boolean value) { - canceled = value - } - - override beginTask(String name, int totalWork) { - } - - override setTaskName(String name) { - } - - override subTask(String name) { - } - - override internalWorked(double work) { - } - - override worked(int work) { - } - - override done() { - } - -} \ No newline at end of file diff --git a/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/editor/bracketmatching/BracePair.java b/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/editor/bracketmatching/BracePair.java deleted file mode 100644 index 0cb14d505..000000000 --- a/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/editor/bracketmatching/BracePair.java +++ /dev/null @@ -1,109 +0,0 @@ -/** - * Copyright (c) 2015 itemis AG (http://www.itemis.eu) and others. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0. - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.eclipse.xtext.ide.editor.bracketmatching; - -import org.eclipse.xtend.lib.annotations.Data; -import org.eclipse.xtext.xbase.lib.Pure; -import org.eclipse.xtext.xbase.lib.util.ToStringBuilder; - -/** - * Defines a single pair of braces which need to be matched when editing code. - * - * @author kosyakov - Initial contribution and API - */ -@Data -@SuppressWarnings("all") -public class BracePair { - /** - * The length of a left brace should be one character for Eclipse. - */ - private final String leftBrace; - - /** - * The length of a right brace should be one character for Eclipse. - */ - private final String rightBrace; - - /** - * True if the brace is structural. Structural braces have higher priority than regular braces: - * they are matched with each other even if there are unmatched braces of other types between them, - * and an opening non-structural brace is not matched with a closing one if one of them is outside a pair - * of matched structural braces and another is outside. In Java code, the curly braces are structural. - * - * It is ignored by Eclipse. - */ - private final boolean structural; - - public BracePair(final String leftBrace, final String rightBrace, final boolean structural) { - super(); - this.leftBrace = leftBrace; - this.rightBrace = rightBrace; - this.structural = structural; - } - - @Override - @Pure - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((this.leftBrace== null) ? 0 : this.leftBrace.hashCode()); - result = prime * result + ((this.rightBrace== null) ? 0 : this.rightBrace.hashCode()); - return prime * result + (this.structural ? 1231 : 1237); - } - - @Override - @Pure - public boolean equals(final Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - BracePair other = (BracePair) obj; - if (this.leftBrace == null) { - if (other.leftBrace != null) - return false; - } else if (!this.leftBrace.equals(other.leftBrace)) - return false; - if (this.rightBrace == null) { - if (other.rightBrace != null) - return false; - } else if (!this.rightBrace.equals(other.rightBrace)) - return false; - if (other.structural != this.structural) - return false; - return true; - } - - @Override - @Pure - public String toString() { - ToStringBuilder b = new ToStringBuilder(this); - b.add("leftBrace", this.leftBrace); - b.add("rightBrace", this.rightBrace); - b.add("structural", this.structural); - return b.toString(); - } - - @Pure - public String getLeftBrace() { - return this.leftBrace; - } - - @Pure - public String getRightBrace() { - return this.rightBrace; - } - - @Pure - public boolean isStructural() { - return this.structural; - } -} diff --git a/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/editor/bracketmatching/DefaultBracePairProvider.java b/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/editor/bracketmatching/DefaultBracePairProvider.java deleted file mode 100644 index 187fd8f3b..000000000 --- a/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/editor/bracketmatching/DefaultBracePairProvider.java +++ /dev/null @@ -1,45 +0,0 @@ -/** - * Copyright (c) 2015 itemis AG (http://www.itemis.eu) and others. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0. - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.eclipse.xtext.ide.editor.bracketmatching; - -import com.google.inject.Singleton; -import java.util.Collections; -import java.util.Set; -import org.eclipse.xtend.lib.annotations.Accessors; -import org.eclipse.xtend.lib.annotations.FinalFieldsConstructor; -import org.eclipse.xtext.ide.editor.bracketmatching.BracePair; -import org.eclipse.xtext.ide.editor.bracketmatching.IBracePairProvider; -import org.eclipse.xtext.xbase.lib.CollectionLiterals; -import org.eclipse.xtext.xbase.lib.Pure; - -/** - * @author kosyakov - Initial contribution and API - */ -@Singleton -@Accessors -@FinalFieldsConstructor -@SuppressWarnings("all") -public class DefaultBracePairProvider implements IBracePairProvider { - private final Set pairs; - - public DefaultBracePairProvider() { - this( - Collections.unmodifiableSet(CollectionLiterals.newHashSet(new BracePair("(", ")", true), new BracePair("{", "}", true), new BracePair("[", "]", true)))); - } - - public DefaultBracePairProvider(final Set pairs) { - super(); - this.pairs = pairs; - } - - @Pure - public Set getPairs() { - return this.pairs; - } -} diff --git a/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/editor/bracketmatching/IBracePairProvider.java b/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/editor/bracketmatching/IBracePairProvider.java deleted file mode 100644 index 33037da67..000000000 --- a/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/editor/bracketmatching/IBracePairProvider.java +++ /dev/null @@ -1,29 +0,0 @@ -/** - * Copyright (c) 2015 itemis AG (http://www.itemis.eu) and others. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0. - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.eclipse.xtext.ide.editor.bracketmatching; - -import java.util.Set; -import org.eclipse.xtext.ide.editor.bracketmatching.BracePair; - -/** - *

- * Provides a set of definitions for brace pairs that need to be matched when - * editing code. - *

- * - * @author kosyakov - Initial contribution and API - */ -@SuppressWarnings("all") -public interface IBracePairProvider { - /** - * Returns a set of definitions for brace pairs that need to be matched when - * editing code. - */ - Set getPairs(); -} diff --git a/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/editor/navigation/INavigatable.java b/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/editor/navigation/INavigatable.java deleted file mode 100644 index 0dc688dec..000000000 --- a/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/editor/navigation/INavigatable.java +++ /dev/null @@ -1,31 +0,0 @@ -/** - * Copyright (c) 2016 TypeFox GmbH (http://www.typefox.io) and others. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0. - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.eclipse.xtext.ide.editor.navigation; - -/** - * Represents an instance that can be opened in an editor. - * - * @author kosyakov - Initial contribution and API - * @since 2.10 - */ -@SuppressWarnings("all") -public interface INavigatable { - /** - *

- * Returns an instance containing enough information to identify an editor that should be opened and a region that should be revealed. - *

- *

- * Typical navigation elements are resource, object and reference descriptions as well as another navigatable element. - *

- *

- * Avoid usage of resource sets, resources and eobjects as navigation elements, since it can lead to memory leaks. - *

- */ - Object getNavigationElement(); -} diff --git a/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/server/ICapabilitiesContributor.java b/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/server/ICapabilitiesContributor.java deleted file mode 100644 index 1b4a418e6..000000000 --- a/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/server/ICapabilitiesContributor.java +++ /dev/null @@ -1,23 +0,0 @@ -/** - * Copyright (c) 2017 TypeFox GmbH (http://www.typefox.io) and others. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0. - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.eclipse.xtext.ide.server; - -import org.eclipse.lsp4j.InitializeParams; -import org.eclipse.lsp4j.ServerCapabilities; - -/** - * @author Sven Efftinge - Initial contribution and API - */ -@SuppressWarnings("all") -public interface ICapabilitiesContributor { - /** - * Allows an individual language to contribute to and overwrite properties in the server's capabilities. - */ - ServerCapabilities contribute(final ServerCapabilities capabilities, final InitializeParams params); -} diff --git a/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/server/ILanguageServerAccess.java b/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/server/ILanguageServerAccess.java deleted file mode 100644 index 03caea8b5..000000000 --- a/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/server/ILanguageServerAccess.java +++ /dev/null @@ -1,246 +0,0 @@ -/** - * Copyright (c) 2016 TypeFox GmbH (http://www.typefox.io) and others. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0. - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.eclipse.xtext.ide.server; - -import java.util.List; -import java.util.concurrent.CompletableFuture; -import java.util.function.Function; -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.ecore.resource.ResourceSet; -import org.eclipse.lsp4j.InitializeParams; -import org.eclipse.lsp4j.InitializeResult; -import org.eclipse.lsp4j.services.LanguageClient; -import org.eclipse.xtend.lib.annotations.Data; -import org.eclipse.xtext.ide.serializer.IChangeSerializer; -import org.eclipse.xtext.ide.server.Document; -import org.eclipse.xtext.resource.IResourceDescription; -import org.eclipse.xtext.resource.IResourceDescriptions; -import org.eclipse.xtext.resource.impl.ResourceDescriptionsProvider; -import org.eclipse.xtext.util.CancelIndicator; -import org.eclipse.xtext.xbase.lib.Pure; -import org.eclipse.xtext.xbase.lib.util.ToStringBuilder; - -/** - * API for interacting with a running language server. - * - * @author Sven Efftinge - Initial contribution and API - */ -@SuppressWarnings("all") -public interface ILanguageServerAccess { - @Data - class Context { - private final Resource resource; - - private final Document document; - - private final boolean isDocumentOpen; - - private final CancelIndicator cancelChecker; - - public Context(final Resource resource, final Document document, final boolean isDocumentOpen, final CancelIndicator cancelChecker) { - super(); - this.resource = resource; - this.document = document; - this.isDocumentOpen = isDocumentOpen; - this.cancelChecker = cancelChecker; - } - - @Override - @Pure - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((this.resource== null) ? 0 : this.resource.hashCode()); - result = prime * result + ((this.document== null) ? 0 : this.document.hashCode()); - result = prime * result + (this.isDocumentOpen ? 1231 : 1237); - return prime * result + ((this.cancelChecker== null) ? 0 : this.cancelChecker.hashCode()); - } - - @Override - @Pure - public boolean equals(final Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - ILanguageServerAccess.Context other = (ILanguageServerAccess.Context) obj; - if (this.resource == null) { - if (other.resource != null) - return false; - } else if (!this.resource.equals(other.resource)) - return false; - if (this.document == null) { - if (other.document != null) - return false; - } else if (!this.document.equals(other.document)) - return false; - if (other.isDocumentOpen != this.isDocumentOpen) - return false; - if (this.cancelChecker == null) { - if (other.cancelChecker != null) - return false; - } else if (!this.cancelChecker.equals(other.cancelChecker)) - return false; - return true; - } - - @Override - @Pure - public String toString() { - ToStringBuilder b = new ToStringBuilder(this); - b.add("resource", this.resource); - b.add("document", this.document); - b.add("isDocumentOpen", this.isDocumentOpen); - b.add("cancelChecker", this.cancelChecker); - return b.toString(); - } - - @Pure - public Resource getResource() { - return this.resource; - } - - @Pure - public Document getDocument() { - return this.document; - } - - @Pure - public boolean isDocumentOpen() { - return this.isDocumentOpen; - } - - @Pure - public CancelIndicator getCancelChecker() { - return this.cancelChecker; - } - } - - @Data - class IndexContext { - private final IResourceDescriptions index; - - private final CancelIndicator cancelChecker; - - public IndexContext(final IResourceDescriptions index, final CancelIndicator cancelChecker) { - super(); - this.index = index; - this.cancelChecker = cancelChecker; - } - - @Override - @Pure - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((this.index== null) ? 0 : this.index.hashCode()); - return prime * result + ((this.cancelChecker== null) ? 0 : this.cancelChecker.hashCode()); - } - - @Override - @Pure - public boolean equals(final Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - ILanguageServerAccess.IndexContext other = (ILanguageServerAccess.IndexContext) obj; - if (this.index == null) { - if (other.index != null) - return false; - } else if (!this.index.equals(other.index)) - return false; - if (this.cancelChecker == null) { - if (other.cancelChecker != null) - return false; - } else if (!this.cancelChecker.equals(other.cancelChecker)) - return false; - return true; - } - - @Override - @Pure - public String toString() { - ToStringBuilder b = new ToStringBuilder(this); - b.add("index", this.index); - b.add("cancelChecker", this.cancelChecker); - return b.toString(); - } - - @Pure - public IResourceDescriptions getIndex() { - return this.index; - } - - @Pure - public CancelIndicator getCancelChecker() { - return this.cancelChecker; - } - } - - interface IBuildListener { - void afterBuild(final List deltas); - } - - /** - * provides read access to a fully resolved resource and Document. - */ - CompletableFuture doRead(final String uri, final Function function); - - /** - * Provides read access to the Xtext index. - * - * @since 2.18 - */ - CompletableFuture doReadIndex(final Function function); - - /** - * registers a build listener on the this language server - */ - void addBuildListener(final ILanguageServerAccess.IBuildListener listener); - - /** - * @return the language client facade. It usually also implements Endpoint, which can be used to - * call non-standard extensions to the LSP. - */ - LanguageClient getLanguageClient(); - - /** - * Creates a new {@link ResourceSet} to be used with the {@link IChangeSerializer} API. - * - * The {@link IChangeSerializer} allows to calculate text edits from model changes. - * In order not to mess up the originals, the resp. models should be loaded into a - * new resource set which this method provides. - * - * @param uri a file URI used to detect the project to configure the scope of the resource set. - * @return a new empty resource set, configured with the project the uri - * belongs to and the {@link ResourceDescriptionsProvider#LIVE_SCOPE} in order to - * reflect model changes immediately. - * @since 2.18 - */ - ResourceSet newLiveScopeResourceSet(final URI uri); - - /** - * @return the parameters as negotiated during client and server on initialization. - * @since 2.18 - */ - InitializeParams getInitializeParams(); - - /** - * Returns with the {@link InitializeResult} of the LS. - * - * @since 2.18 - */ - InitializeResult getInitializeResult(); -} diff --git a/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/server/ILanguageServerExtension.java b/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/server/ILanguageServerExtension.java deleted file mode 100644 index 4b81be019..000000000 --- a/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/server/ILanguageServerExtension.java +++ /dev/null @@ -1,33 +0,0 @@ -/** - * Copyright (c) 2016 TypeFox GmbH (http://www.typefox.io) and others. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0. - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.eclipse.xtext.ide.server; - -import org.eclipse.xtext.ide.server.ILanguageServerAccess; - -/** - * Interface for language specific extensions to the LSP. - * Implementors should use {link JsonRpcNotification} and {link JsonRpcRequest} annotations. - * - * @author Sven Efftinge - Initial contribution and API - */ -@SuppressWarnings("all") -public interface ILanguageServerExtension { - /** - * The same jsonrpc method might be supported by multiple languages and only the actual invocation - * might reveal is a language wants to handle it, based on e.g. a uri in the parameter. - * - * To indicate that a request is not handled, this exception should be thrown by the service. - */ - static final RuntimeException NOT_HANDLED_EXCEPTION = new UnsupportedOperationException("not handled"); - - /** - * the language server provides a access to language server documents, resources and build events. - */ - void initialize(final ILanguageServerAccess access); -} diff --git a/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/server/ServerModule.java b/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/server/ServerModule.java deleted file mode 100644 index 1851024d5..000000000 --- a/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/server/ServerModule.java +++ /dev/null @@ -1,42 +0,0 @@ -/** - * Copyright (c) 2016 TypeFox GmbH (http://www.typefox.io) and others. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0. - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.eclipse.xtext.ide.server; - -import com.google.inject.AbstractModule; -import java.util.concurrent.ExecutorService; -import org.eclipse.lsp4j.services.LanguageServer; -import org.eclipse.xtext.ide.ExecutorServiceProvider; -import org.eclipse.xtext.ide.server.DefaultProjectDescriptionFactory; -import org.eclipse.xtext.ide.server.IProjectDescriptionFactory; -import org.eclipse.xtext.ide.server.IWorkspaceConfigFactory; -import org.eclipse.xtext.ide.server.LanguageServerImpl; -import org.eclipse.xtext.ide.server.MultiRootWorkspaceConfigFactory; -import org.eclipse.xtext.ide.server.ProjectWorkspaceConfigFactory; -import org.eclipse.xtext.resource.IContainer; -import org.eclipse.xtext.resource.IResourceServiceProvider; -import org.eclipse.xtext.resource.ResourceServiceProviderServiceLoader; -import org.eclipse.xtext.resource.containers.ProjectDescriptionBasedContainerManager; - -/** - * @author Sven Efftinge - Initial contribution and API - * @since 2.11 - */ -@SuppressWarnings("all") -public class ServerModule extends AbstractModule { - @Override - protected void configure() { - this.binder().bind(ExecutorService.class).toProvider(ExecutorServiceProvider.class); - this.bind(LanguageServer.class).to(LanguageServerImpl.class); - this.bind(IResourceServiceProvider.Registry.class).toProvider(ResourceServiceProviderServiceLoader.class); - this.bind(IWorkspaceConfigFactory.class).to(ProjectWorkspaceConfigFactory.class); - this.bind(ProjectWorkspaceConfigFactory.class).to(MultiRootWorkspaceConfigFactory.class); - this.bind(IProjectDescriptionFactory.class).to(DefaultProjectDescriptionFactory.class); - this.bind(IContainer.Manager.class).to(ProjectDescriptionBasedContainerManager.class); - } -} diff --git a/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/server/codeActions/ICodeActionService2.java b/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/server/codeActions/ICodeActionService2.java deleted file mode 100644 index 6d3e75e8e..000000000 --- a/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/server/codeActions/ICodeActionService2.java +++ /dev/null @@ -1,88 +0,0 @@ -/** - * Copyright (c) 2017, 2020 TypeFox GmbH (http://www.typefox.io) and others. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0. - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.eclipse.xtext.ide.server.codeActions; - -import java.util.List; -import org.eclipse.lsp4j.CodeAction; -import org.eclipse.lsp4j.CodeActionParams; -import org.eclipse.lsp4j.Command; -import org.eclipse.lsp4j.jsonrpc.messages.Either; -import org.eclipse.xtend.lib.annotations.Accessors; -import org.eclipse.xtext.ide.server.Document; -import org.eclipse.xtext.ide.server.ILanguageServerAccess; -import org.eclipse.xtext.resource.XtextResource; -import org.eclipse.xtext.util.CancelIndicator; -import org.eclipse.xtext.xbase.lib.Pure; - -/** - * @author Jan Koehnlein - * @since 2.18 - */ -@SuppressWarnings("all") -public interface ICodeActionService2 { - @Accessors - class Options { - private Document document; - - private XtextResource resource; - - private ILanguageServerAccess languageServerAccess; - - private CodeActionParams codeActionParams; - - private CancelIndicator cancelIndicator; - - @Pure - public Document getDocument() { - return this.document; - } - - public void setDocument(final Document document) { - this.document = document; - } - - @Pure - public XtextResource getResource() { - return this.resource; - } - - public void setResource(final XtextResource resource) { - this.resource = resource; - } - - @Pure - public ILanguageServerAccess getLanguageServerAccess() { - return this.languageServerAccess; - } - - public void setLanguageServerAccess(final ILanguageServerAccess languageServerAccess) { - this.languageServerAccess = languageServerAccess; - } - - @Pure - public CodeActionParams getCodeActionParams() { - return this.codeActionParams; - } - - public void setCodeActionParams(final CodeActionParams codeActionParams) { - this.codeActionParams = codeActionParams; - } - - @Pure - public CancelIndicator getCancelIndicator() { - return this.cancelIndicator; - } - - public void setCancelIndicator(final CancelIndicator cancelIndicator) { - this.cancelIndicator = cancelIndicator; - } - } - - List> getCodeActions(final ICodeActionService2.Options options); -} diff --git a/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/server/hover/HoverContext.java b/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/server/hover/HoverContext.java deleted file mode 100644 index 6c9d31dd2..000000000 --- a/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/server/hover/HoverContext.java +++ /dev/null @@ -1,66 +0,0 @@ -/** - * Copyright (c) 2016, 2020 TypeFox GmbH (http://www.typefox.io) and others. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0. - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.eclipse.xtext.ide.server.hover; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.xtend.lib.annotations.Accessors; -import org.eclipse.xtend.lib.annotations.FinalFieldsConstructor; -import org.eclipse.xtext.ide.server.Document; -import org.eclipse.xtext.resource.XtextResource; -import org.eclipse.xtext.util.ITextRegion; -import org.eclipse.xtext.xbase.lib.Pure; - -@Accessors -@FinalFieldsConstructor -@SuppressWarnings("all") -public class HoverContext { - private final Document document; - - private final XtextResource resource; - - private final int offset; - - private final ITextRegion region; - - private final EObject element; - - public HoverContext(final Document document, final XtextResource resource, final int offset, final ITextRegion region, final EObject element) { - super(); - this.document = document; - this.resource = resource; - this.offset = offset; - this.region = region; - this.element = element; - } - - @Pure - public Document getDocument() { - return this.document; - } - - @Pure - public XtextResource getResource() { - return this.resource; - } - - @Pure - public int getOffset() { - return this.offset; - } - - @Pure - public ITextRegion getRegion() { - return this.region; - } - - @Pure - public EObject getElement() { - return this.element; - } -} diff --git a/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/server/semanticHighlight/ISemanticHighlightingStyleToTokenMapper.java b/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/server/semanticHighlight/ISemanticHighlightingStyleToTokenMapper.java deleted file mode 100644 index f9cdc5e08..000000000 --- a/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/server/semanticHighlight/ISemanticHighlightingStyleToTokenMapper.java +++ /dev/null @@ -1,61 +0,0 @@ -/** - * Copyright (c) 2018 TypeFox and others. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0. - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.eclipse.xtext.ide.server.semanticHighlight; - -import com.google.inject.ImplementedBy; -import com.google.inject.Singleton; -import java.util.List; -import java.util.Set; -import org.eclipse.xtext.ide.editor.syntaxcoloring.IHighlightedPositionAcceptor; -import org.eclipse.xtext.ide.editor.syntaxcoloring.ISemanticHighlightingCalculator; -import org.eclipse.xtext.ide.editor.syntaxcoloring.LightweightPosition; -import org.eclipse.xtext.ide.server.semanticHighlight.SemanticHighlightingRegistry; -import org.eclipse.xtext.xbase.lib.CollectionLiterals; - -/** - * Service for mapping the IDs of the highlighting styles to a list of TextMate scopes. - * - * @see IHighlightedPositionAcceptor#addPosition - * @see LightweightPosition#getIds - */ -@ImplementedBy(ISemanticHighlightingStyleToTokenMapper.Noop.class) -@SuppressWarnings("all") -public interface ISemanticHighlightingStyleToTokenMapper { - /** - * The shared, default NOOP implementation of the semantic style ID to TextMate token mapper. - */ - @Singleton - final class Noop implements ISemanticHighlightingStyleToTokenMapper { - @Override - public List toScopes(final String styleId) { - return SemanticHighlightingRegistry.UNKNOWN_SCOPES; - } - - @Override - public Set getAllStyleIds() { - return CollectionLiterals.emptySet(); - } - } - - /** - * Maps the highlighting style ID to the corresponding TextMate scopes. - */ - List toScopes(final String styleId); - - /** - * Returns with a set of distinct style identifiers that are used by the {@link IHighlightedPositionAcceptor} when calculating - * the highlighted positions with the {@link ISemanticHighlightingCalculator}. - * - *

- * Must not return with {@code null} but an empty set instead. - * - * @see IHighlightedPositionAcceptor#addPosition - */ - Set getAllStyleIds(); -} diff --git a/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/util/CancelIndicatorProgressMonitor.java b/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/util/CancelIndicatorProgressMonitor.java deleted file mode 100644 index 7a49a2cf2..000000000 --- a/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/util/CancelIndicatorProgressMonitor.java +++ /dev/null @@ -1,64 +0,0 @@ -/** - * Copyright (c) 2016 TypeFox GmbH (http://www.typefox.io) and others. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0. - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.eclipse.xtext.ide.util; - -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.xtend.lib.annotations.FinalFieldsConstructor; -import org.eclipse.xtext.util.CancelIndicator; - -/** - * @author kosyakov - Initial contribution and API - * @since 2.11 - */ -@FinalFieldsConstructor -@SuppressWarnings("all") -public class CancelIndicatorProgressMonitor implements IProgressMonitor { - private final CancelIndicator delegate; - - private boolean canceled; - - @Override - public boolean isCanceled() { - return (this.canceled || this.delegate.isCanceled()); - } - - @Override - public void setCanceled(final boolean value) { - this.canceled = value; - } - - @Override - public void beginTask(final String name, final int totalWork) { - } - - @Override - public void setTaskName(final String name) { - } - - @Override - public void subTask(final String name) { - } - - @Override - public void internalWorked(final double work) { - } - - @Override - public void worked(final int work) { - } - - @Override - public void done() { - } - - public CancelIndicatorProgressMonitor(final CancelIndicator delegate) { - super(); - this.delegate = delegate; - } -}