[eclipse/xtext#1569] Refactor Xtend to Java

The usage of Xtend in the Xtext code base should be reduced where the
usage of Xtend is not super beneficial. Replaced Xtend classes by the
compiled code and refactored the code to more readable Java.

This change extracts classes formerly defined in
AbstractLanguageServerTests.xtend to own files.

Signed-off-by: Karsten Thoms <karsten.thoms@itemis.de>
This commit is contained in:
Karsten Thoms 2019-10-29 09:57:32 +01:00
parent 12c5a2215e
commit 5083d86efa
31 changed files with 507 additions and 691 deletions

View file

@ -717,88 +717,3 @@ abstract class AbstractLanguageServerTest implements Endpoint {
}
}
@Data class FileInfo {
String uri
String contents
}
@Accessors
class TestCompletionConfiguration extends TextDocumentPositionConfiguration {
String expectedCompletionItems = ''
(CompletionList)=>void assertCompletionList = null
}
@Accessors
class DefinitionTestConfiguration extends TextDocumentPositionConfiguration {
String expectedDefinitions = ''
(List<? extends Location>)=>void assertDefinitions = null
}
@Accessors
class HoverTestConfiguration extends TextDocumentPositionConfiguration {
String expectedHover = ''
(Hover)=>void assertHover = null
}
@Accessors
class SignatureHelpConfiguration extends TextDocumentPositionConfiguration {
String expectedSignatureHelp = ''
(SignatureHelp)=>void assertSignatureHelp = null
}
@Accessors
class DocumentHighlightConfiguration extends TextDocumentPositionConfiguration {
String expectedDocumentHighlight = ''
}
@Accessors
class DocumentSymbolConfiguraiton extends TextDocumentConfiguration {
String expectedSymbols = ''
(List<Either<SymbolInformation, DocumentSymbol>>)=>void assertSymbols = null
}
@Accessors
class ReferenceTestConfiguration extends TextDocumentPositionConfiguration {
boolean includeDeclaration = false
String expectedReferences = ''
(List<? extends Location>)=>void assertReferences = null
}
@Accessors
class WorkspaceSymbolConfiguration extends TextDocumentConfiguration {
String query = ''
String expectedSymbols = ''
(List<? extends SymbolInformation>)=>void assertSymbols = null
}
@Accessors
class TextDocumentPositionConfiguration extends TextDocumentConfiguration {
int line = 0
int column = 0
}
@Accessors
class TextDocumentConfiguration {
Map<String, CharSequence> filesInScope = emptyMap
String model
String filePath
(InitializeParams)=>void initializer
}
@Accessors
class FormattingConfiguration extends TextDocumentConfiguration {
String expectedText = ''
}
@Accessors
class ColoringConfiguration extends TextDocumentConfiguration {
String expectedColoredRangesWithStyles = '';
}
@Accessors
class RangeFormattingConfiguration extends FormattingConfiguration {
Range range = new Range => [
start = new Position(0, 0)
end = new Position(0, 1)
]
}

View file

@ -0,0 +1,20 @@
/**
* Copyright (c) 2016, 2017 TypeFox GmbH (http://www.typefox.io) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*/
package org.eclipse.xtext.testing;
public class ColoringConfiguration extends TextDocumentConfiguration {
private String expectedColoredRangesWithStyles = "";
public String getExpectedColoredRangesWithStyles() {
return expectedColoredRangesWithStyles;
}
public void setExpectedColoredRangesWithStyles(String expectedColoredRangesWithStyles) {
this.expectedColoredRangesWithStyles = expectedColoredRangesWithStyles;
}
}

View file

@ -0,0 +1,35 @@
/**
* Copyright (c) 2016, 2017 TypeFox GmbH (http://www.typefox.io) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*/
package org.eclipse.xtext.testing;
import java.util.List;
import org.eclipse.lsp4j.Location;
import org.eclipse.xtext.xbase.lib.Procedures.Procedure1;
public class DefinitionTestConfiguration extends TextDocumentPositionConfiguration {
private String expectedDefinitions = "";
private Procedure1<? super List<? extends Location>> assertDefinitions = null;
public String getExpectedDefinitions() {
return expectedDefinitions;
}
public void setExpectedDefinitions(String expectedDefinitions) {
this.expectedDefinitions = expectedDefinitions;
}
public Procedure1<? super List<? extends Location>> getAssertDefinitions() {
return assertDefinitions;
}
public void setAssertDefinitions(Procedure1<? super List<? extends Location>> assertDefinitions) {
this.assertDefinitions = assertDefinitions;
}
}

View file

@ -0,0 +1,20 @@
/**
* Copyright (c) 2016, 2017 TypeFox GmbH (http://www.typefox.io) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*/
package org.eclipse.xtext.testing;
public class DocumentHighlightConfiguration extends TextDocumentPositionConfiguration {
private String expectedDocumentHighlight = "";
public String getExpectedDocumentHighlight() {
return expectedDocumentHighlight;
}
public void setExpectedDocumentHighlight(String expectedDocumentHighlight) {
this.expectedDocumentHighlight = expectedDocumentHighlight;
}
}

View file

@ -0,0 +1,37 @@
/**
* Copyright (c) 2016, 2017 TypeFox GmbH (http://www.typefox.io) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*/
package org.eclipse.xtext.testing;
import java.util.List;
import org.eclipse.lsp4j.DocumentSymbol;
import org.eclipse.lsp4j.SymbolInformation;
import org.eclipse.lsp4j.jsonrpc.messages.Either;
import org.eclipse.xtext.xbase.lib.Procedures.Procedure1;
public class DocumentSymbolConfiguraiton extends TextDocumentConfiguration {
private String expectedSymbols = "";
private Procedure1<? super List<Either<SymbolInformation, DocumentSymbol>>> assertSymbols = null;
public String getExpectedSymbols() {
return expectedSymbols;
}
public void setExpectedSymbols(String expectedSymbols) {
this.expectedSymbols = expectedSymbols;
}
public Procedure1<? super List<Either<SymbolInformation, DocumentSymbol>>> getAssertSymbols() {
return assertSymbols;
}
public void setAssertSymbols(Procedure1<? super List<Either<SymbolInformation, DocumentSymbol>>> assertSymbols) {
this.assertSymbols = assertSymbols;
}
}

View file

@ -0,0 +1,75 @@
/**
* Copyright (c) 2016, 2017 TypeFox GmbH (http://www.typefox.io) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*/
package org.eclipse.xtext.testing;
import org.eclipse.xtext.xbase.lib.util.ToStringBuilder;
public class FileInfo {
private final String uri;
private final String contents;
public FileInfo(String uri, String contents) {
super();
this.uri = uri;
this.contents = contents;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((uri == null) ? 0 : uri.hashCode());
return prime * result + ((contents == null) ? 0 : contents.hashCode());
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
FileInfo other = (FileInfo) obj;
if (uri == null) {
if (other.uri != null) {
return false;
}
} else if (!uri.equals(other.uri)) {
return false;
}
if (contents == null) {
if (other.contents != null) {
return false;
}
} else if (!contents.equals(other.contents)) {
return false;
}
return true;
}
@Override
public String toString() {
ToStringBuilder b = new ToStringBuilder(this);
b.add("uri", uri);
b.add("contents", contents);
return b.toString();
}
public String getUri() {
return uri;
}
public String getContents() {
return contents;
}
}

View file

@ -91,5 +91,4 @@ public @interface Flaky {
}
}
}

View file

@ -0,0 +1,20 @@
/**
* Copyright (c) 2016, 2017 TypeFox GmbH (http://www.typefox.io) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*/
package org.eclipse.xtext.testing;
public class FormattingConfiguration extends TextDocumentConfiguration {
private String expectedText = "";
public String getExpectedText() {
return expectedText;
}
public void setExpectedText(String expectedText) {
this.expectedText = expectedText;
}
}

View file

@ -0,0 +1,33 @@
/**
* Copyright (c) 2016, 2017 TypeFox GmbH (http://www.typefox.io) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*/
package org.eclipse.xtext.testing;
import org.eclipse.lsp4j.Hover;
import org.eclipse.xtext.xbase.lib.Procedures.Procedure1;
public class HoverTestConfiguration extends TextDocumentPositionConfiguration {
private String expectedHover = "";
private Procedure1<? super Hover> assertHover = null;
public String getExpectedHover() {
return expectedHover;
}
public void setExpectedHover(String expectedHover) {
this.expectedHover = expectedHover;
}
public Procedure1<? super Hover> getAssertHover() {
return assertHover;
}
public void setAssertHover(Procedure1<? super Hover> assertHover) {
this.assertHover = assertHover;
}
}

View file

@ -0,0 +1,23 @@
/**
* Copyright (c) 2016, 2017 TypeFox GmbH (http://www.typefox.io) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*/
package org.eclipse.xtext.testing;
import org.eclipse.lsp4j.Position;
import org.eclipse.lsp4j.Range;
public class RangeFormattingConfiguration extends FormattingConfiguration {
private Range range = new Range(new Position(0, 0), new Position(0, 1));
public Range getRange() {
return range;
}
public void setRange(Range range) {
this.range = range;
}
}

View file

@ -0,0 +1,45 @@
/**
* Copyright (c) 2016, 2017 TypeFox GmbH (http://www.typefox.io) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*/
package org.eclipse.xtext.testing;
import java.util.List;
import org.eclipse.lsp4j.Location;
import org.eclipse.xtext.xbase.lib.Procedures.Procedure1;
public class ReferenceTestConfiguration extends TextDocumentPositionConfiguration {
private boolean includeDeclaration = false;
private String expectedReferences = "";
private Procedure1<? super List<? extends Location>> assertReferences = null;
public boolean isIncludeDeclaration() {
return includeDeclaration;
}
public void setIncludeDeclaration(boolean includeDeclaration) {
this.includeDeclaration = includeDeclaration;
}
public String getExpectedReferences() {
return expectedReferences;
}
public void setExpectedReferences(String expectedReferences) {
this.expectedReferences = expectedReferences;
}
public Procedure1<? super List<? extends Location>> getAssertReferences() {
return assertReferences;
}
public void setAssertReferences(Procedure1<? super List<? extends Location>> assertReferences) {
this.assertReferences = assertReferences;
}
}

View file

@ -0,0 +1,33 @@
/**
* Copyright (c) 2016, 2017 TypeFox GmbH (http://www.typefox.io) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*/
package org.eclipse.xtext.testing;
import org.eclipse.lsp4j.SignatureHelp;
import org.eclipse.xtext.xbase.lib.Procedures.Procedure1;
public class SignatureHelpConfiguration extends TextDocumentPositionConfiguration {
private String expectedSignatureHelp = "";
private Procedure1<? super SignatureHelp> assertSignatureHelp = null;
public String getExpectedSignatureHelp() {
return expectedSignatureHelp;
}
public void setExpectedSignatureHelp(String expectedSignatureHelp) {
this.expectedSignatureHelp = expectedSignatureHelp;
}
public Procedure1<? super SignatureHelp> getAssertSignatureHelp() {
return assertSignatureHelp;
}
public void setAssertSignatureHelp(Procedure1<? super SignatureHelp> assertSignatureHelp) {
this.assertSignatureHelp = assertSignatureHelp;
}
}

View file

@ -0,0 +1,33 @@
/**
* Copyright (c) 2016, 2017 TypeFox GmbH (http://www.typefox.io) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*/
package org.eclipse.xtext.testing;
import org.eclipse.lsp4j.CompletionList;
import org.eclipse.xtext.xbase.lib.Procedures.Procedure1;
public class TestCompletionConfiguration extends TextDocumentPositionConfiguration {
private String expectedCompletionItems = "";
private Procedure1<? super CompletionList> assertCompletionList = null;
public String getExpectedCompletionItems() {
return expectedCompletionItems;
}
public void setExpectedCompletionItems(String expectedCompletionItems) {
this.expectedCompletionItems = expectedCompletionItems;
}
public Procedure1<? super CompletionList> getAssertCompletionList() {
return assertCompletionList;
}
public void setAssertCompletionList(Procedure1<? super CompletionList> assertCompletionList) {
this.assertCompletionList = assertCompletionList;
}
}

View file

@ -0,0 +1,56 @@
/**
* Copyright (c) 2016, 2017 TypeFox GmbH (http://www.typefox.io) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*/
package org.eclipse.xtext.testing;
import java.util.Map;
import org.eclipse.lsp4j.InitializeParams;
import org.eclipse.xtext.xbase.lib.CollectionLiterals;
import org.eclipse.xtext.xbase.lib.Procedures.Procedure1;
public class TextDocumentConfiguration {
private Map<String, CharSequence> filesInScope = CollectionLiterals.<String, CharSequence>emptyMap();
private String model;
private String filePath;
private Procedure1<? super InitializeParams> initializer;
public Map<String, CharSequence> getFilesInScope() {
return filesInScope;
}
public void setFilesInScope(Map<String, CharSequence> filesInScope) {
this.filesInScope = filesInScope;
}
public String getModel() {
return model;
}
public void setModel(String model) {
this.model = model;
}
public String getFilePath() {
return filePath;
}
public void setFilePath(String filePath) {
this.filePath = filePath;
}
public Procedure1<? super InitializeParams> getInitializer() {
return initializer;
}
public void setInitializer(Procedure1<? super InitializeParams> initializer) {
this.initializer = initializer;
}
}

View file

@ -0,0 +1,30 @@
/**
* Copyright (c) 2016, 2017 TypeFox GmbH (http://www.typefox.io) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*/
package org.eclipse.xtext.testing;
public class TextDocumentPositionConfiguration extends TextDocumentConfiguration {
private int line = 0;
private int column = 0;
public int getLine() {
return line;
}
public void setLine(int line) {
this.line = line;
}
public int getColumn() {
return column;
}
public void setColumn(int column) {
this.column = column;
}
}

View file

@ -0,0 +1,45 @@
/**
* Copyright (c) 2016, 2017 TypeFox GmbH (http://www.typefox.io) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*/
package org.eclipse.xtext.testing;
import java.util.List;
import org.eclipse.lsp4j.SymbolInformation;
import org.eclipse.xtext.xbase.lib.Procedures.Procedure1;
public class WorkspaceSymbolConfiguration extends TextDocumentConfiguration {
private String query = "";
private String expectedSymbols = "";
private Procedure1<? super List<? extends SymbolInformation>> assertSymbols = null;
public String getQuery() {
return query;
}
public void setQuery(String query) {
this.query = query;
}
public String getExpectedSymbols() {
return expectedSymbols;
}
public void setExpectedSymbols(String expectedSymbols) {
this.expectedSymbols = expectedSymbols;
}
public Procedure1<? super List<? extends SymbolInformation>> getAssertSymbols() {
return assertSymbols;
}
public void setAssertSymbols(Procedure1<? super List<? extends SymbolInformation>> assertSymbols) {
this.assertSymbols = assertSymbols;
}
}

View file

@ -39,9 +39,9 @@ public class XtextRunner extends BlockJUnit4ClassRunner {
protected Statement methodBlock(FrameworkMethod method) {
IInjectorProvider injectorProvider = getOrCreateInjectorProvider();
if (injectorProvider instanceof IRegistryConfigurator) {
final IRegistryConfigurator registryConfigurator = (IRegistryConfigurator) injectorProvider;
IRegistryConfigurator registryConfigurator = (IRegistryConfigurator) injectorProvider;
registryConfigurator.setupRegistry();
final Statement methodBlock = superMethodBlock(method);
Statement methodBlock = superMethodBlock(method);
return new Statement() {
@Override
public void evaluate() throws Throwable {

View file

@ -1,27 +0,0 @@
/**
* Copyright (c) 2016, 2019 TypeFox GmbH (http://www.typefox.io) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*/
package org.eclipse.xtext.testing;
import org.eclipse.xtend.lib.annotations.Accessors;
import org.eclipse.xtext.testing.TextDocumentConfiguration;
import org.eclipse.xtext.xbase.lib.Pure;
@Accessors
@SuppressWarnings("all")
public class ColoringConfiguration extends TextDocumentConfiguration {
private String expectedColoredRangesWithStyles = "";
@Pure
public String getExpectedColoredRangesWithStyles() {
return this.expectedColoredRangesWithStyles;
}
public void setExpectedColoredRangesWithStyles(final String expectedColoredRangesWithStyles) {
this.expectedColoredRangesWithStyles = expectedColoredRangesWithStyles;
}
}

View file

@ -1,41 +0,0 @@
/**
* Copyright (c) 2016, 2019 TypeFox GmbH (http://www.typefox.io) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*/
package org.eclipse.xtext.testing;
import java.util.List;
import org.eclipse.lsp4j.Location;
import org.eclipse.xtend.lib.annotations.Accessors;
import org.eclipse.xtext.testing.TextDocumentPositionConfiguration;
import org.eclipse.xtext.xbase.lib.Procedures.Procedure1;
import org.eclipse.xtext.xbase.lib.Pure;
@Accessors
@SuppressWarnings("all")
public class DefinitionTestConfiguration extends TextDocumentPositionConfiguration {
private String expectedDefinitions = "";
private Procedure1<? super List<? extends Location>> assertDefinitions = null;
@Pure
public String getExpectedDefinitions() {
return this.expectedDefinitions;
}
public void setExpectedDefinitions(final String expectedDefinitions) {
this.expectedDefinitions = expectedDefinitions;
}
@Pure
public Procedure1<? super List<? extends Location>> getAssertDefinitions() {
return this.assertDefinitions;
}
public void setAssertDefinitions(final Procedure1<? super List<? extends Location>> assertDefinitions) {
this.assertDefinitions = assertDefinitions;
}
}

View file

@ -1,27 +0,0 @@
/**
* Copyright (c) 2016, 2019 TypeFox GmbH (http://www.typefox.io) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*/
package org.eclipse.xtext.testing;
import org.eclipse.xtend.lib.annotations.Accessors;
import org.eclipse.xtext.testing.TextDocumentPositionConfiguration;
import org.eclipse.xtext.xbase.lib.Pure;
@Accessors
@SuppressWarnings("all")
public class DocumentHighlightConfiguration extends TextDocumentPositionConfiguration {
private String expectedDocumentHighlight = "";
@Pure
public String getExpectedDocumentHighlight() {
return this.expectedDocumentHighlight;
}
public void setExpectedDocumentHighlight(final String expectedDocumentHighlight) {
this.expectedDocumentHighlight = expectedDocumentHighlight;
}
}

View file

@ -1,43 +0,0 @@
/**
* Copyright (c) 2016, 2019 TypeFox GmbH (http://www.typefox.io) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*/
package org.eclipse.xtext.testing;
import java.util.List;
import org.eclipse.lsp4j.DocumentSymbol;
import org.eclipse.lsp4j.SymbolInformation;
import org.eclipse.lsp4j.jsonrpc.messages.Either;
import org.eclipse.xtend.lib.annotations.Accessors;
import org.eclipse.xtext.testing.TextDocumentConfiguration;
import org.eclipse.xtext.xbase.lib.Procedures.Procedure1;
import org.eclipse.xtext.xbase.lib.Pure;
@Accessors
@SuppressWarnings("all")
public class DocumentSymbolConfiguraiton extends TextDocumentConfiguration {
private String expectedSymbols = "";
private Procedure1<? super List<Either<SymbolInformation, DocumentSymbol>>> assertSymbols = null;
@Pure
public String getExpectedSymbols() {
return this.expectedSymbols;
}
public void setExpectedSymbols(final String expectedSymbols) {
this.expectedSymbols = expectedSymbols;
}
@Pure
public Procedure1<? super List<Either<SymbolInformation, DocumentSymbol>>> getAssertSymbols() {
return this.assertSymbols;
}
public void setAssertSymbols(final Procedure1<? super List<Either<SymbolInformation, DocumentSymbol>>> assertSymbols) {
this.assertSymbols = assertSymbols;
}
}

View file

@ -1,77 +0,0 @@
/**
* Copyright (c) 2016, 2019 TypeFox GmbH (http://www.typefox.io) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*/
package org.eclipse.xtext.testing;
import org.eclipse.xtend.lib.annotations.Data;
import org.eclipse.xtext.xbase.lib.Pure;
import org.eclipse.xtext.xbase.lib.util.ToStringBuilder;
@Data
@SuppressWarnings("all")
public class FileInfo {
private final String uri;
private final String contents;
public FileInfo(final String uri, final String contents) {
super();
this.uri = uri;
this.contents = contents;
}
@Override
@Pure
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((this.uri== null) ? 0 : this.uri.hashCode());
return prime * result + ((this.contents== null) ? 0 : this.contents.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;
FileInfo other = (FileInfo) obj;
if (this.uri == null) {
if (other.uri != null)
return false;
} else if (!this.uri.equals(other.uri))
return false;
if (this.contents == null) {
if (other.contents != null)
return false;
} else if (!this.contents.equals(other.contents))
return false;
return true;
}
@Override
@Pure
public String toString() {
ToStringBuilder b = new ToStringBuilder(this);
b.add("uri", this.uri);
b.add("contents", this.contents);
return b.toString();
}
@Pure
public String getUri() {
return this.uri;
}
@Pure
public String getContents() {
return this.contents;
}
}

View file

@ -1,27 +0,0 @@
/**
* Copyright (c) 2016, 2019 TypeFox GmbH (http://www.typefox.io) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*/
package org.eclipse.xtext.testing;
import org.eclipse.xtend.lib.annotations.Accessors;
import org.eclipse.xtext.testing.TextDocumentConfiguration;
import org.eclipse.xtext.xbase.lib.Pure;
@Accessors
@SuppressWarnings("all")
public class FormattingConfiguration extends TextDocumentConfiguration {
private String expectedText = "";
@Pure
public String getExpectedText() {
return this.expectedText;
}
public void setExpectedText(final String expectedText) {
this.expectedText = expectedText;
}
}

View file

@ -1,40 +0,0 @@
/**
* Copyright (c) 2016, 2019 TypeFox GmbH (http://www.typefox.io) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*/
package org.eclipse.xtext.testing;
import org.eclipse.lsp4j.Hover;
import org.eclipse.xtend.lib.annotations.Accessors;
import org.eclipse.xtext.testing.TextDocumentPositionConfiguration;
import org.eclipse.xtext.xbase.lib.Procedures.Procedure1;
import org.eclipse.xtext.xbase.lib.Pure;
@Accessors
@SuppressWarnings("all")
public class HoverTestConfiguration extends TextDocumentPositionConfiguration {
private String expectedHover = "";
private Procedure1<? super Hover> assertHover = null;
@Pure
public String getExpectedHover() {
return this.expectedHover;
}
public void setExpectedHover(final String expectedHover) {
this.expectedHover = expectedHover;
}
@Pure
public Procedure1<? super Hover> getAssertHover() {
return this.assertHover;
}
public void setAssertHover(final Procedure1<? super Hover> assertHover) {
this.assertHover = assertHover;
}
}

View file

@ -1,36 +0,0 @@
/**
* Copyright (c) 2016, 2019 TypeFox GmbH (http://www.typefox.io) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*/
package org.eclipse.xtext.testing;
import org.eclipse.lsp4j.Position;
import org.eclipse.lsp4j.Range;
import org.eclipse.xtend.lib.annotations.Accessors;
import org.eclipse.xtext.testing.FormattingConfiguration;
import org.eclipse.xtext.xbase.lib.ObjectExtensions;
import org.eclipse.xtext.xbase.lib.Procedures.Procedure1;
import org.eclipse.xtext.xbase.lib.Pure;
@Accessors
@SuppressWarnings("all")
public class RangeFormattingConfiguration extends FormattingConfiguration {
private Range range = ObjectExtensions.<Range>operator_doubleArrow(new Range(), ((Procedure1<Range>) (Range it) -> {
Position _position = new Position(0, 0);
it.setStart(_position);
Position _position_1 = new Position(0, 1);
it.setEnd(_position_1);
}));
@Pure
public Range getRange() {
return this.range;
}
public void setRange(final Range range) {
this.range = range;
}
}

View file

@ -1,52 +0,0 @@
/**
* Copyright (c) 2016, 2019 TypeFox GmbH (http://www.typefox.io) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*/
package org.eclipse.xtext.testing;
import java.util.List;
import org.eclipse.lsp4j.Location;
import org.eclipse.xtend.lib.annotations.Accessors;
import org.eclipse.xtext.testing.TextDocumentPositionConfiguration;
import org.eclipse.xtext.xbase.lib.Procedures.Procedure1;
import org.eclipse.xtext.xbase.lib.Pure;
@Accessors
@SuppressWarnings("all")
public class ReferenceTestConfiguration extends TextDocumentPositionConfiguration {
private boolean includeDeclaration = false;
private String expectedReferences = "";
private Procedure1<? super List<? extends Location>> assertReferences = null;
@Pure
public boolean isIncludeDeclaration() {
return this.includeDeclaration;
}
public void setIncludeDeclaration(final boolean includeDeclaration) {
this.includeDeclaration = includeDeclaration;
}
@Pure
public String getExpectedReferences() {
return this.expectedReferences;
}
public void setExpectedReferences(final String expectedReferences) {
this.expectedReferences = expectedReferences;
}
@Pure
public Procedure1<? super List<? extends Location>> getAssertReferences() {
return this.assertReferences;
}
public void setAssertReferences(final Procedure1<? super List<? extends Location>> assertReferences) {
this.assertReferences = assertReferences;
}
}

View file

@ -1,40 +0,0 @@
/**
* Copyright (c) 2016, 2019 TypeFox GmbH (http://www.typefox.io) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*/
package org.eclipse.xtext.testing;
import org.eclipse.lsp4j.SignatureHelp;
import org.eclipse.xtend.lib.annotations.Accessors;
import org.eclipse.xtext.testing.TextDocumentPositionConfiguration;
import org.eclipse.xtext.xbase.lib.Procedures.Procedure1;
import org.eclipse.xtext.xbase.lib.Pure;
@Accessors
@SuppressWarnings("all")
public class SignatureHelpConfiguration extends TextDocumentPositionConfiguration {
private String expectedSignatureHelp = "";
private Procedure1<? super SignatureHelp> assertSignatureHelp = null;
@Pure
public String getExpectedSignatureHelp() {
return this.expectedSignatureHelp;
}
public void setExpectedSignatureHelp(final String expectedSignatureHelp) {
this.expectedSignatureHelp = expectedSignatureHelp;
}
@Pure
public Procedure1<? super SignatureHelp> getAssertSignatureHelp() {
return this.assertSignatureHelp;
}
public void setAssertSignatureHelp(final Procedure1<? super SignatureHelp> assertSignatureHelp) {
this.assertSignatureHelp = assertSignatureHelp;
}
}

View file

@ -1,40 +0,0 @@
/**
* Copyright (c) 2016, 2019 TypeFox GmbH (http://www.typefox.io) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*/
package org.eclipse.xtext.testing;
import org.eclipse.lsp4j.CompletionList;
import org.eclipse.xtend.lib.annotations.Accessors;
import org.eclipse.xtext.testing.TextDocumentPositionConfiguration;
import org.eclipse.xtext.xbase.lib.Procedures.Procedure1;
import org.eclipse.xtext.xbase.lib.Pure;
@Accessors
@SuppressWarnings("all")
public class TestCompletionConfiguration extends TextDocumentPositionConfiguration {
private String expectedCompletionItems = "";
private Procedure1<? super CompletionList> assertCompletionList = null;
@Pure
public String getExpectedCompletionItems() {
return this.expectedCompletionItems;
}
public void setExpectedCompletionItems(final String expectedCompletionItems) {
this.expectedCompletionItems = expectedCompletionItems;
}
@Pure
public Procedure1<? super CompletionList> getAssertCompletionList() {
return this.assertCompletionList;
}
public void setAssertCompletionList(final Procedure1<? super CompletionList> assertCompletionList) {
this.assertCompletionList = assertCompletionList;
}
}

View file

@ -1,63 +0,0 @@
/**
* Copyright (c) 2016, 2019 TypeFox GmbH (http://www.typefox.io) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*/
package org.eclipse.xtext.testing;
import java.util.Map;
import org.eclipse.lsp4j.InitializeParams;
import org.eclipse.xtend.lib.annotations.Accessors;
import org.eclipse.xtext.xbase.lib.CollectionLiterals;
import org.eclipse.xtext.xbase.lib.Procedures.Procedure1;
import org.eclipse.xtext.xbase.lib.Pure;
@Accessors
@SuppressWarnings("all")
public class TextDocumentConfiguration {
private Map<String, CharSequence> filesInScope = CollectionLiterals.<String, CharSequence>emptyMap();
private String model;
private String filePath;
private Procedure1<? super InitializeParams> initializer;
@Pure
public Map<String, CharSequence> getFilesInScope() {
return this.filesInScope;
}
public void setFilesInScope(final Map<String, CharSequence> filesInScope) {
this.filesInScope = filesInScope;
}
@Pure
public String getModel() {
return this.model;
}
public void setModel(final String model) {
this.model = model;
}
@Pure
public String getFilePath() {
return this.filePath;
}
public void setFilePath(final String filePath) {
this.filePath = filePath;
}
@Pure
public Procedure1<? super InitializeParams> getInitializer() {
return this.initializer;
}
public void setInitializer(final Procedure1<? super InitializeParams> initializer) {
this.initializer = initializer;
}
}

View file

@ -1,38 +0,0 @@
/**
* Copyright (c) 2016, 2019 TypeFox GmbH (http://www.typefox.io) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*/
package org.eclipse.xtext.testing;
import org.eclipse.xtend.lib.annotations.Accessors;
import org.eclipse.xtext.testing.TextDocumentConfiguration;
import org.eclipse.xtext.xbase.lib.Pure;
@Accessors
@SuppressWarnings("all")
public class TextDocumentPositionConfiguration extends TextDocumentConfiguration {
private int line = 0;
private int column = 0;
@Pure
public int getLine() {
return this.line;
}
public void setLine(final int line) {
this.line = line;
}
@Pure
public int getColumn() {
return this.column;
}
public void setColumn(final int column) {
this.column = column;
}
}

View file

@ -1,52 +0,0 @@
/**
* Copyright (c) 2016, 2019 TypeFox GmbH (http://www.typefox.io) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*/
package org.eclipse.xtext.testing;
import java.util.List;
import org.eclipse.lsp4j.SymbolInformation;
import org.eclipse.xtend.lib.annotations.Accessors;
import org.eclipse.xtext.testing.TextDocumentConfiguration;
import org.eclipse.xtext.xbase.lib.Procedures.Procedure1;
import org.eclipse.xtext.xbase.lib.Pure;
@Accessors
@SuppressWarnings("all")
public class WorkspaceSymbolConfiguration extends TextDocumentConfiguration {
private String query = "";
private String expectedSymbols = "";
private Procedure1<? super List<? extends SymbolInformation>> assertSymbols = null;
@Pure
public String getQuery() {
return this.query;
}
public void setQuery(final String query) {
this.query = query;
}
@Pure
public String getExpectedSymbols() {
return this.expectedSymbols;
}
public void setExpectedSymbols(final String expectedSymbols) {
this.expectedSymbols = expectedSymbols;
}
@Pure
public Procedure1<? super List<? extends SymbolInformation>> getAssertSymbols() {
return this.assertSymbols;
}
public void setAssertSymbols(final Procedure1<? super List<? extends SymbolInformation>> assertSymbols) {
this.assertSymbols = assertSymbols;
}
}