mirror of
https://github.com/sigmasternchen/xtext-core
synced 2025-03-15 16:28:56 +00:00
commit
7fd54060a6
15 changed files with 119 additions and 107 deletions
|
@ -3,7 +3,7 @@ version = '2.11.0-SNAPSHOT'
|
|||
ext.versions = [
|
||||
'xtext': version,
|
||||
'xtext_bootstrap': '2.10.0',
|
||||
'lsapi': '0.2.0-SNAPSHOT',
|
||||
'lsapi': '0.3.0-SNAPSHOT',
|
||||
'log4j': '1.2.16',
|
||||
'equinoxCommon' : '3.6.0',
|
||||
'equinoxRegistry' : '3.5.0.v20100503',
|
||||
|
|
|
@ -27,25 +27,25 @@ class DocumentSymbolTest extends AbstractTestLangLanguageServerTest {
|
|||
'''
|
||||
expectedSymbols = '''
|
||||
symbol "Foo" {
|
||||
kind: 0
|
||||
kind: 7
|
||||
location: MyModel.testlang [[0, 5] .. [0, 8]]
|
||||
}
|
||||
symbol "Foo.bar" {
|
||||
kind: 0
|
||||
kind: 7
|
||||
location: MyModel.testlang [[1, 5] .. [1, 8]]
|
||||
container: "Foo"
|
||||
}
|
||||
symbol "Foo.bar.int" {
|
||||
kind: 0
|
||||
kind: 7
|
||||
location: MyModel.testlang [[1, 1] .. [1, 4]]
|
||||
container: "Foo.bar"
|
||||
}
|
||||
symbol "Bar" {
|
||||
kind: 0
|
||||
kind: 7
|
||||
location: MyModel.testlang [[3, 5] .. [3, 8]]
|
||||
}
|
||||
symbol "Bar.foo" {
|
||||
kind: 0
|
||||
kind: 7
|
||||
location: MyModel.testlang [[4, 5] .. [4, 8]]
|
||||
container: "Bar"
|
||||
}
|
||||
|
|
|
@ -13,6 +13,7 @@ import org.junit.Test
|
|||
import static org.junit.Assert.*
|
||||
|
||||
import static extension io.typefox.lsapi.util.LsapiFactories.*
|
||||
import io.typefox.lsapi.FileChangeType
|
||||
|
||||
/**
|
||||
* @author Sven Efftinge - Initial contribution and API
|
||||
|
@ -36,7 +37,7 @@ class OpenDocumentTest extends AbstractTestLangLanguageServerTest {
|
|||
'''
|
||||
languageServer.getWorkspaceService.didChangeWatchedFiles(
|
||||
#[
|
||||
newFileEvent(path, FileEvent.TYPE_CREATED)
|
||||
newFileEvent(path, FileChangeType.Created)
|
||||
].newDidChangeWatchedFilesParams
|
||||
)
|
||||
|
||||
|
|
|
@ -13,6 +13,7 @@ import org.junit.Test
|
|||
import static org.junit.Assert.*
|
||||
|
||||
import static extension io.typefox.lsapi.util.LsapiFactories.*
|
||||
import io.typefox.lsapi.FileChangeType
|
||||
|
||||
/**
|
||||
* @author Sven Efftinge - Initial contribution and API
|
||||
|
@ -61,7 +62,7 @@ class ServerTest extends AbstractTestLangLanguageServerTest {
|
|||
'''
|
||||
|
||||
languageServer.getWorkspaceService.didChangeWatchedFiles(
|
||||
#[newFileEvent(path, FileEvent.TYPE_CREATED)].newDidChangeWatchedFilesParams
|
||||
#[newFileEvent(path, FileChangeType.Created)].newDidChangeWatchedFilesParams
|
||||
)
|
||||
assertNotNull(diagnostics.get(path))
|
||||
assertTrue(diagnostics.values.join(','), diagnostics.values.forall[empty])
|
||||
|
|
|
@ -28,19 +28,19 @@ class WorkspaceSymbolTest extends AbstractTestLangLanguageServerTest {
|
|||
query = 'F'
|
||||
expectedSymbols = '''
|
||||
symbol "Foo" {
|
||||
kind: 0
|
||||
kind: 7
|
||||
location: MyModel.testlang [[0, 5] .. [0, 8]]
|
||||
}
|
||||
symbol "Foo.bar" {
|
||||
kind: 0
|
||||
kind: 7
|
||||
location: MyModel.testlang [[1, 5] .. [1, 8]]
|
||||
}
|
||||
symbol "Foo.bar.int" {
|
||||
kind: 0
|
||||
kind: 7
|
||||
location: MyModel.testlang [[1, 1] .. [1, 4]]
|
||||
}
|
||||
symbol "Bar.foo" {
|
||||
kind: 0
|
||||
kind: 7
|
||||
location: MyModel.testlang [[4, 5] .. [4, 8]]
|
||||
}
|
||||
'''
|
||||
|
@ -61,19 +61,19 @@ class WorkspaceSymbolTest extends AbstractTestLangLanguageServerTest {
|
|||
query = 'oO'
|
||||
expectedSymbols = '''
|
||||
symbol "Foo" {
|
||||
kind: 0
|
||||
kind: 7
|
||||
location: MyModel.testlang [[0, 5] .. [0, 8]]
|
||||
}
|
||||
symbol "Foo.bar" {
|
||||
kind: 0
|
||||
kind: 7
|
||||
location: MyModel.testlang [[1, 5] .. [1, 8]]
|
||||
}
|
||||
symbol "Foo.bar.int" {
|
||||
kind: 0
|
||||
kind: 7
|
||||
location: MyModel.testlang [[1, 1] .. [1, 4]]
|
||||
}
|
||||
symbol "Bar.foo" {
|
||||
kind: 0
|
||||
kind: 7
|
||||
location: MyModel.testlang [[4, 5] .. [4, 8]]
|
||||
}
|
||||
'''
|
||||
|
|
|
@ -41,7 +41,7 @@ public class DocumentSymbolTest extends AbstractTestLangLanguageServerTest {
|
|||
_builder_1.append("symbol \"Foo\" {");
|
||||
_builder_1.newLine();
|
||||
_builder_1.append("\t");
|
||||
_builder_1.append("kind: 0");
|
||||
_builder_1.append("kind: 7");
|
||||
_builder_1.newLine();
|
||||
_builder_1.append("\t");
|
||||
_builder_1.append("location: MyModel.testlang [[0, 5] .. [0, 8]]");
|
||||
|
@ -51,7 +51,7 @@ public class DocumentSymbolTest extends AbstractTestLangLanguageServerTest {
|
|||
_builder_1.append("symbol \"Foo.bar\" {");
|
||||
_builder_1.newLine();
|
||||
_builder_1.append("\t");
|
||||
_builder_1.append("kind: 0");
|
||||
_builder_1.append("kind: 7");
|
||||
_builder_1.newLine();
|
||||
_builder_1.append("\t");
|
||||
_builder_1.append("location: MyModel.testlang [[1, 5] .. [1, 8]]");
|
||||
|
@ -64,7 +64,7 @@ public class DocumentSymbolTest extends AbstractTestLangLanguageServerTest {
|
|||
_builder_1.append("symbol \"Foo.bar.int\" {");
|
||||
_builder_1.newLine();
|
||||
_builder_1.append("\t");
|
||||
_builder_1.append("kind: 0");
|
||||
_builder_1.append("kind: 7");
|
||||
_builder_1.newLine();
|
||||
_builder_1.append("\t");
|
||||
_builder_1.append("location: MyModel.testlang [[1, 1] .. [1, 4]]");
|
||||
|
@ -77,7 +77,7 @@ public class DocumentSymbolTest extends AbstractTestLangLanguageServerTest {
|
|||
_builder_1.append("symbol \"Bar\" {");
|
||||
_builder_1.newLine();
|
||||
_builder_1.append("\t");
|
||||
_builder_1.append("kind: 0");
|
||||
_builder_1.append("kind: 7");
|
||||
_builder_1.newLine();
|
||||
_builder_1.append("\t");
|
||||
_builder_1.append("location: MyModel.testlang [[3, 5] .. [3, 8]]");
|
||||
|
@ -87,7 +87,7 @@ public class DocumentSymbolTest extends AbstractTestLangLanguageServerTest {
|
|||
_builder_1.append("symbol \"Bar.foo\" {");
|
||||
_builder_1.newLine();
|
||||
_builder_1.append("\t");
|
||||
_builder_1.append("kind: 0");
|
||||
_builder_1.append("kind: 7");
|
||||
_builder_1.newLine();
|
||||
_builder_1.append("\t");
|
||||
_builder_1.append("location: MyModel.testlang [[4, 5] .. [4, 8]]");
|
||||
|
|
|
@ -10,7 +10,7 @@ package org.eclipse.xtext.ide.tests.server;
|
|||
import io.typefox.lsapi.Diagnostic;
|
||||
import io.typefox.lsapi.DidChangeTextDocumentParamsImpl;
|
||||
import io.typefox.lsapi.DidChangeWatchedFilesParamsImpl;
|
||||
import io.typefox.lsapi.FileEvent;
|
||||
import io.typefox.lsapi.FileChangeType;
|
||||
import io.typefox.lsapi.FileEventImpl;
|
||||
import io.typefox.lsapi.PositionImpl;
|
||||
import io.typefox.lsapi.RangeImpl;
|
||||
|
@ -54,7 +54,7 @@ public class OpenDocumentTest extends AbstractTestLangLanguageServerTest {
|
|||
_builder_1.newLine();
|
||||
final String path = this.operator_mappedTo("MyType2.testlang", _builder_1);
|
||||
WorkspaceService _workspaceService = this.languageServer.getWorkspaceService();
|
||||
FileEventImpl _newFileEvent = LsapiFactories.newFileEvent(path, FileEvent.TYPE_CREATED);
|
||||
FileEventImpl _newFileEvent = LsapiFactories.newFileEvent(path, FileChangeType.Created);
|
||||
DidChangeWatchedFilesParamsImpl _newDidChangeWatchedFilesParams = LsapiFactories.newDidChangeWatchedFilesParams(Collections.<FileEventImpl>unmodifiableList(CollectionLiterals.<FileEventImpl>newArrayList(_newFileEvent)));
|
||||
_workspaceService.didChangeWatchedFiles(_newDidChangeWatchedFilesParams);
|
||||
List<? extends Diagnostic> _get_1 = this.diagnostics.get(firstFile);
|
||||
|
|
|
@ -9,7 +9,7 @@ package org.eclipse.xtext.ide.tests.server;
|
|||
|
||||
import io.typefox.lsapi.Diagnostic;
|
||||
import io.typefox.lsapi.DidChangeWatchedFilesParamsImpl;
|
||||
import io.typefox.lsapi.FileEvent;
|
||||
import io.typefox.lsapi.FileChangeType;
|
||||
import io.typefox.lsapi.FileEventImpl;
|
||||
import io.typefox.lsapi.Position;
|
||||
import io.typefox.lsapi.Range;
|
||||
|
@ -130,7 +130,7 @@ public class ServerTest extends AbstractTestLangLanguageServerTest {
|
|||
_builder_1.newLine();
|
||||
final String path = this.operator_mappedTo("MyType2.testlang", _builder_1);
|
||||
WorkspaceService _workspaceService = this.languageServer.getWorkspaceService();
|
||||
FileEventImpl _newFileEvent = LsapiFactories.newFileEvent(path, FileEvent.TYPE_CREATED);
|
||||
FileEventImpl _newFileEvent = LsapiFactories.newFileEvent(path, FileChangeType.Created);
|
||||
DidChangeWatchedFilesParamsImpl _newDidChangeWatchedFilesParams = LsapiFactories.newDidChangeWatchedFilesParams(Collections.<FileEventImpl>unmodifiableList(CollectionLiterals.<FileEventImpl>newArrayList(_newFileEvent)));
|
||||
_workspaceService.didChangeWatchedFiles(_newDidChangeWatchedFilesParams);
|
||||
List<? extends Diagnostic> _get = this.diagnostics.get(path);
|
||||
|
|
|
@ -42,7 +42,7 @@ public class WorkspaceSymbolTest extends AbstractTestLangLanguageServerTest {
|
|||
_builder_1.append("symbol \"Foo\" {");
|
||||
_builder_1.newLine();
|
||||
_builder_1.append("\t");
|
||||
_builder_1.append("kind: 0");
|
||||
_builder_1.append("kind: 7");
|
||||
_builder_1.newLine();
|
||||
_builder_1.append("\t");
|
||||
_builder_1.append("location: MyModel.testlang [[0, 5] .. [0, 8]]");
|
||||
|
@ -52,7 +52,7 @@ public class WorkspaceSymbolTest extends AbstractTestLangLanguageServerTest {
|
|||
_builder_1.append("symbol \"Foo.bar\" {");
|
||||
_builder_1.newLine();
|
||||
_builder_1.append("\t");
|
||||
_builder_1.append("kind: 0");
|
||||
_builder_1.append("kind: 7");
|
||||
_builder_1.newLine();
|
||||
_builder_1.append("\t");
|
||||
_builder_1.append("location: MyModel.testlang [[1, 5] .. [1, 8]]");
|
||||
|
@ -62,7 +62,7 @@ public class WorkspaceSymbolTest extends AbstractTestLangLanguageServerTest {
|
|||
_builder_1.append("symbol \"Foo.bar.int\" {");
|
||||
_builder_1.newLine();
|
||||
_builder_1.append("\t");
|
||||
_builder_1.append("kind: 0");
|
||||
_builder_1.append("kind: 7");
|
||||
_builder_1.newLine();
|
||||
_builder_1.append("\t");
|
||||
_builder_1.append("location: MyModel.testlang [[1, 1] .. [1, 4]]");
|
||||
|
@ -72,7 +72,7 @@ public class WorkspaceSymbolTest extends AbstractTestLangLanguageServerTest {
|
|||
_builder_1.append("symbol \"Bar.foo\" {");
|
||||
_builder_1.newLine();
|
||||
_builder_1.append("\t");
|
||||
_builder_1.append("kind: 0");
|
||||
_builder_1.append("kind: 7");
|
||||
_builder_1.newLine();
|
||||
_builder_1.append("\t");
|
||||
_builder_1.append("location: MyModel.testlang [[4, 5] .. [4, 8]]");
|
||||
|
@ -108,7 +108,7 @@ public class WorkspaceSymbolTest extends AbstractTestLangLanguageServerTest {
|
|||
_builder_1.append("symbol \"Foo\" {");
|
||||
_builder_1.newLine();
|
||||
_builder_1.append("\t");
|
||||
_builder_1.append("kind: 0");
|
||||
_builder_1.append("kind: 7");
|
||||
_builder_1.newLine();
|
||||
_builder_1.append("\t");
|
||||
_builder_1.append("location: MyModel.testlang [[0, 5] .. [0, 8]]");
|
||||
|
@ -118,7 +118,7 @@ public class WorkspaceSymbolTest extends AbstractTestLangLanguageServerTest {
|
|||
_builder_1.append("symbol \"Foo.bar\" {");
|
||||
_builder_1.newLine();
|
||||
_builder_1.append("\t");
|
||||
_builder_1.append("kind: 0");
|
||||
_builder_1.append("kind: 7");
|
||||
_builder_1.newLine();
|
||||
_builder_1.append("\t");
|
||||
_builder_1.append("location: MyModel.testlang [[1, 5] .. [1, 8]]");
|
||||
|
@ -128,7 +128,7 @@ public class WorkspaceSymbolTest extends AbstractTestLangLanguageServerTest {
|
|||
_builder_1.append("symbol \"Foo.bar.int\" {");
|
||||
_builder_1.newLine();
|
||||
_builder_1.append("\t");
|
||||
_builder_1.append("kind: 0");
|
||||
_builder_1.append("kind: 7");
|
||||
_builder_1.newLine();
|
||||
_builder_1.append("\t");
|
||||
_builder_1.append("location: MyModel.testlang [[1, 1] .. [1, 4]]");
|
||||
|
@ -138,7 +138,7 @@ public class WorkspaceSymbolTest extends AbstractTestLangLanguageServerTest {
|
|||
_builder_1.append("symbol \"Bar.foo\" {");
|
||||
_builder_1.newLine();
|
||||
_builder_1.append("\t");
|
||||
_builder_1.append("kind: 0");
|
||||
_builder_1.append("kind: 7");
|
||||
_builder_1.newLine();
|
||||
_builder_1.append("\t");
|
||||
_builder_1.append("location: MyModel.testlang [[4, 5] .. [4, 8]]");
|
||||
|
|
|
@ -73,6 +73,10 @@ import org.eclipse.xtext.resource.IResourceServiceProvider
|
|||
import org.eclipse.xtext.validation.Issue
|
||||
|
||||
import static extension io.typefox.lsapi.util.LsapiFactories.*
|
||||
import io.typefox.lsapi.TextDocumentSyncKind
|
||||
import io.typefox.lsapi.FileChangeType
|
||||
import io.typefox.lsapi.DiagnosticSeverity
|
||||
import io.typefox.lsapi.CompletionItemKind
|
||||
|
||||
/**
|
||||
* @author Sven Efftinge - Initial contribution and API
|
||||
|
@ -110,7 +114,7 @@ import static extension io.typefox.lsapi.util.LsapiFactories.*
|
|||
referencesProvider = true
|
||||
documentSymbolProvider = true
|
||||
workspaceSymbolProvider = true
|
||||
textDocumentSync = ServerCapabilities.SYNC_INCREMENTAL
|
||||
textDocumentSync = TextDocumentSyncKind.Incremental
|
||||
completionProvider = new CompletionOptionsImpl => [
|
||||
resolveProvider = false
|
||||
triggerCharacters = #["."]
|
||||
|
@ -204,7 +208,7 @@ import static extension io.typefox.lsapi.util.LsapiFactories.*
|
|||
val dirtyFiles = newArrayList
|
||||
val deletedFiles = newArrayList
|
||||
for (fileEvent : params.changes) {
|
||||
if (fileEvent.type === FileEvent.TYPE_DELETED) {
|
||||
if (fileEvent.type === FileChangeType.Deleted) {
|
||||
deletedFiles += toUri(fileEvent.uri)
|
||||
} else {
|
||||
dirtyFiles += toUri(fileEvent.uri)
|
||||
|
@ -244,10 +248,10 @@ import static extension io.typefox.lsapi.util.LsapiFactories.*
|
|||
new DiagnosticImpl => [
|
||||
code = issue.code
|
||||
severity = switch issue.severity {
|
||||
case ERROR: Diagnostic.SEVERITY_ERROR
|
||||
case WARNING: Diagnostic.SEVERITY_WARNING
|
||||
case INFO: Diagnostic.SEVERITY_INFO
|
||||
default: Diagnostic.SEVERITY_HINT
|
||||
case ERROR: DiagnosticSeverity.Error
|
||||
case WARNING: DiagnosticSeverity.Warning
|
||||
case INFO: DiagnosticSeverity.Information
|
||||
default: DiagnosticSeverity.Hint
|
||||
}
|
||||
message = issue.message
|
||||
val lineNumber = (issue.lineNumber ?: 1) - 1
|
||||
|
@ -300,25 +304,25 @@ import static extension io.typefox.lsapi.util.LsapiFactories.*
|
|||
|
||||
protected def translateKind(ContentAssistEntry entry) {
|
||||
switch entry.kind {
|
||||
case ContentAssistEntry.KIND_CLASS : CompletionItem.KIND_CLASS
|
||||
case ContentAssistEntry.KIND_COLOR : CompletionItem.KIND_COLOR
|
||||
case ContentAssistEntry.KIND_CONSTRUCTOR : CompletionItem.KIND_CONSTRUCTOR
|
||||
case ContentAssistEntry.KIND_ENUM : CompletionItem.KIND_ENUM
|
||||
case ContentAssistEntry.KIND_FIELD : CompletionItem.KIND_FIELD
|
||||
case ContentAssistEntry.KIND_FILE : CompletionItem.KIND_FILE
|
||||
case ContentAssistEntry.KIND_FUNCTION : CompletionItem.KIND_FUNCTION
|
||||
case ContentAssistEntry.KIND_INTERFACE : CompletionItem.KIND_INTERFACE
|
||||
case ContentAssistEntry.KIND_KEYWORD : CompletionItem.KIND_KEYWORD
|
||||
case ContentAssistEntry.KIND_METHOD : CompletionItem.KIND_METHOD
|
||||
case ContentAssistEntry.KIND_MODULE : CompletionItem.KIND_MODULE
|
||||
case ContentAssistEntry.KIND_PROPERTY : CompletionItem.KIND_PROPERTY
|
||||
case ContentAssistEntry.KIND_REFERENCE : CompletionItem.KIND_REFERENCE
|
||||
case ContentAssistEntry.KIND_SNIPPET : CompletionItem.KIND_SNIPPET
|
||||
case ContentAssistEntry.KIND_TEXT : CompletionItem.KIND_TEXT
|
||||
case ContentAssistEntry.KIND_UNIT : CompletionItem.KIND_UNIT
|
||||
case ContentAssistEntry.KIND_VALUE : CompletionItem.KIND_VALUE
|
||||
case ContentAssistEntry.KIND_VARIABLE : CompletionItem.KIND_VARIABLE
|
||||
default : CompletionItem.KIND_VALUE
|
||||
case ContentAssistEntry.KIND_CLASS : CompletionItemKind.Class
|
||||
case ContentAssistEntry.KIND_COLOR : CompletionItemKind.Color
|
||||
case ContentAssistEntry.KIND_CONSTRUCTOR : CompletionItemKind.Constructor
|
||||
case ContentAssistEntry.KIND_ENUM : CompletionItemKind.Enum
|
||||
case ContentAssistEntry.KIND_FIELD : CompletionItemKind.Field
|
||||
case ContentAssistEntry.KIND_FILE : CompletionItemKind.File
|
||||
case ContentAssistEntry.KIND_FUNCTION : CompletionItemKind.Function
|
||||
case ContentAssistEntry.KIND_INTERFACE : CompletionItemKind.Interface
|
||||
case ContentAssistEntry.KIND_KEYWORD : CompletionItemKind.Keyword
|
||||
case ContentAssistEntry.KIND_METHOD : CompletionItemKind.Method
|
||||
case ContentAssistEntry.KIND_MODULE : CompletionItemKind.Module
|
||||
case ContentAssistEntry.KIND_PROPERTY : CompletionItemKind.Property
|
||||
case ContentAssistEntry.KIND_REFERENCE : CompletionItemKind.Reference
|
||||
case ContentAssistEntry.KIND_SNIPPET : CompletionItemKind.Snippet
|
||||
case ContentAssistEntry.KIND_TEXT : CompletionItemKind.Text
|
||||
case ContentAssistEntry.KIND_UNIT : CompletionItemKind.Unit
|
||||
case ContentAssistEntry.KIND_VALUE : CompletionItemKind.Value
|
||||
case ContentAssistEntry.KIND_VARIABLE : CompletionItemKind.Variable
|
||||
default : CompletionItemKind.Value
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -36,6 +36,7 @@ import org.eclipse.xtext.service.OperationCanceledManager
|
|||
import org.eclipse.xtext.util.CancelIndicator
|
||||
|
||||
import static extension org.eclipse.emf.ecore.util.EcoreUtil.*
|
||||
import io.typefox.lsapi.SymbolKind
|
||||
|
||||
/**
|
||||
* @author kosyakov - Initial contribution and API
|
||||
|
@ -161,7 +162,7 @@ class DocumentSymbolService {
|
|||
return object.fullyQualifiedName.symbolName
|
||||
}
|
||||
|
||||
protected def int getSymbolKind(EObject object) {
|
||||
protected def SymbolKind getSymbolKind(EObject object) {
|
||||
return object.eClass.symbolKind
|
||||
}
|
||||
|
||||
|
@ -205,7 +206,7 @@ class DocumentSymbolService {
|
|||
return description.qualifiedName.symbolName
|
||||
}
|
||||
|
||||
protected def int getSymbolKind(IEObjectDescription description) {
|
||||
protected def SymbolKind getSymbolKind(IEObjectDescription description) {
|
||||
return description.EClass.symbolKind
|
||||
}
|
||||
|
||||
|
@ -213,9 +214,9 @@ class DocumentSymbolService {
|
|||
return qualifiedName?.toString
|
||||
}
|
||||
|
||||
protected def int getSymbolKind(EClass type) {
|
||||
return 0
|
||||
// return SymbolInformation.KIND_PROPERTY
|
||||
protected def SymbolKind getSymbolKind(EClass type) {
|
||||
//TODO implement meaningful
|
||||
return SymbolKind.Property
|
||||
}
|
||||
|
||||
protected def void doRead(IResourceAccess resourceAccess, URI objectURI, (EObject)=>void acceptor) {
|
||||
|
|
|
@ -16,11 +16,12 @@ import io.typefox.lsapi.CodeLensParams;
|
|||
import io.typefox.lsapi.Command;
|
||||
import io.typefox.lsapi.CompletionItem;
|
||||
import io.typefox.lsapi.CompletionItemImpl;
|
||||
import io.typefox.lsapi.CompletionItemKind;
|
||||
import io.typefox.lsapi.CompletionList;
|
||||
import io.typefox.lsapi.CompletionListImpl;
|
||||
import io.typefox.lsapi.CompletionOptionsImpl;
|
||||
import io.typefox.lsapi.Diagnostic;
|
||||
import io.typefox.lsapi.DiagnosticImpl;
|
||||
import io.typefox.lsapi.DiagnosticSeverity;
|
||||
import io.typefox.lsapi.DidChangeConfigurationParams;
|
||||
import io.typefox.lsapi.DidChangeTextDocumentParams;
|
||||
import io.typefox.lsapi.DidChangeWatchedFilesParams;
|
||||
|
@ -32,6 +33,7 @@ import io.typefox.lsapi.DocumentHighlight;
|
|||
import io.typefox.lsapi.DocumentOnTypeFormattingParams;
|
||||
import io.typefox.lsapi.DocumentRangeFormattingParams;
|
||||
import io.typefox.lsapi.DocumentSymbolParams;
|
||||
import io.typefox.lsapi.FileChangeType;
|
||||
import io.typefox.lsapi.FileEvent;
|
||||
import io.typefox.lsapi.Hover;
|
||||
import io.typefox.lsapi.InitializeParams;
|
||||
|
@ -49,7 +51,6 @@ import io.typefox.lsapi.RangeImpl;
|
|||
import io.typefox.lsapi.ReferenceContext;
|
||||
import io.typefox.lsapi.ReferenceParams;
|
||||
import io.typefox.lsapi.RenameParams;
|
||||
import io.typefox.lsapi.ServerCapabilities;
|
||||
import io.typefox.lsapi.ServerCapabilitiesImpl;
|
||||
import io.typefox.lsapi.ShowMessageRequestParams;
|
||||
import io.typefox.lsapi.SignatureHelp;
|
||||
|
@ -58,6 +59,7 @@ import io.typefox.lsapi.TextDocumentContentChangeEvent;
|
|||
import io.typefox.lsapi.TextDocumentIdentifier;
|
||||
import io.typefox.lsapi.TextDocumentItem;
|
||||
import io.typefox.lsapi.TextDocumentPositionParams;
|
||||
import io.typefox.lsapi.TextDocumentSyncKind;
|
||||
import io.typefox.lsapi.TextEdit;
|
||||
import io.typefox.lsapi.TextEditImpl;
|
||||
import io.typefox.lsapi.VersionedTextDocumentIdentifier;
|
||||
|
@ -165,7 +167,7 @@ public class LanguageServerImpl implements LanguageServer, WorkspaceService, Win
|
|||
it.setReferencesProvider(Boolean.valueOf(true));
|
||||
it.setDocumentSymbolProvider(Boolean.valueOf(true));
|
||||
it.setWorkspaceSymbolProvider(Boolean.valueOf(true));
|
||||
it.setTextDocumentSync(Integer.valueOf(ServerCapabilities.SYNC_INCREMENTAL));
|
||||
it.setTextDocumentSync(TextDocumentSyncKind.Incremental);
|
||||
CompletionOptionsImpl _completionOptionsImpl = new CompletionOptionsImpl();
|
||||
final Procedure1<CompletionOptionsImpl> _function_1 = (CompletionOptionsImpl it_1) -> {
|
||||
it_1.setResolveProvider(false);
|
||||
|
@ -319,8 +321,8 @@ public class LanguageServerImpl implements LanguageServer, WorkspaceService, Win
|
|||
final ArrayList<URI> deletedFiles = CollectionLiterals.<URI>newArrayList();
|
||||
List<? extends FileEvent> _changes = params.getChanges();
|
||||
for (final FileEvent fileEvent : _changes) {
|
||||
int _type = fileEvent.getType();
|
||||
boolean _tripleEquals = (_type == FileEvent.TYPE_DELETED);
|
||||
FileChangeType _type = fileEvent.getType();
|
||||
boolean _tripleEquals = (_type == FileChangeType.Deleted);
|
||||
if (_tripleEquals) {
|
||||
String _uri = fileEvent.getUri();
|
||||
URI _uri_1 = this._uriExtensions.toUri(_uri);
|
||||
|
@ -376,27 +378,27 @@ public class LanguageServerImpl implements LanguageServer, WorkspaceService, Win
|
|||
final Procedure1<DiagnosticImpl> _function = (DiagnosticImpl it) -> {
|
||||
String _code = issue.getCode();
|
||||
it.setCode(_code);
|
||||
int _switchResult = (int) 0;
|
||||
DiagnosticSeverity _switchResult = null;
|
||||
Severity _severity = issue.getSeverity();
|
||||
if (_severity != null) {
|
||||
switch (_severity) {
|
||||
case ERROR:
|
||||
_switchResult = Diagnostic.SEVERITY_ERROR;
|
||||
_switchResult = DiagnosticSeverity.Error;
|
||||
break;
|
||||
case WARNING:
|
||||
_switchResult = Diagnostic.SEVERITY_WARNING;
|
||||
_switchResult = DiagnosticSeverity.Warning;
|
||||
break;
|
||||
case INFO:
|
||||
_switchResult = Diagnostic.SEVERITY_INFO;
|
||||
_switchResult = DiagnosticSeverity.Information;
|
||||
break;
|
||||
default:
|
||||
_switchResult = Diagnostic.SEVERITY_HINT;
|
||||
_switchResult = DiagnosticSeverity.Hint;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
_switchResult = Diagnostic.SEVERITY_HINT;
|
||||
_switchResult = DiagnosticSeverity.Hint;
|
||||
}
|
||||
it.setSeverity(Integer.valueOf(_switchResult));
|
||||
it.setSeverity(_switchResult);
|
||||
String _message = issue.getMessage();
|
||||
it.setMessage(_message);
|
||||
Integer _elvis = null;
|
||||
|
@ -504,71 +506,71 @@ public class LanguageServerImpl implements LanguageServer, WorkspaceService, Win
|
|||
String _proposal_2 = entry.getProposal();
|
||||
completionItem.setInsertText(_proposal_2);
|
||||
}
|
||||
int _translateKind = this.translateKind(entry);
|
||||
completionItem.setKind(Integer.valueOf(_translateKind));
|
||||
CompletionItemKind _translateKind = this.translateKind(entry);
|
||||
completionItem.setKind(_translateKind);
|
||||
return completionItem;
|
||||
}
|
||||
|
||||
protected int translateKind(final ContentAssistEntry entry) {
|
||||
int _switchResult = (int) 0;
|
||||
protected CompletionItemKind translateKind(final ContentAssistEntry entry) {
|
||||
CompletionItemKind _switchResult = null;
|
||||
String _kind = entry.getKind();
|
||||
switch (_kind) {
|
||||
case ContentAssistEntry.KIND_CLASS:
|
||||
_switchResult = CompletionItem.KIND_CLASS;
|
||||
_switchResult = CompletionItemKind.Class;
|
||||
break;
|
||||
case ContentAssistEntry.KIND_COLOR:
|
||||
_switchResult = CompletionItem.KIND_COLOR;
|
||||
_switchResult = CompletionItemKind.Color;
|
||||
break;
|
||||
case ContentAssistEntry.KIND_CONSTRUCTOR:
|
||||
_switchResult = CompletionItem.KIND_CONSTRUCTOR;
|
||||
_switchResult = CompletionItemKind.Constructor;
|
||||
break;
|
||||
case ContentAssistEntry.KIND_ENUM:
|
||||
_switchResult = CompletionItem.KIND_ENUM;
|
||||
_switchResult = CompletionItemKind.Enum;
|
||||
break;
|
||||
case ContentAssistEntry.KIND_FIELD:
|
||||
_switchResult = CompletionItem.KIND_FIELD;
|
||||
_switchResult = CompletionItemKind.Field;
|
||||
break;
|
||||
case ContentAssistEntry.KIND_FILE:
|
||||
_switchResult = CompletionItem.KIND_FILE;
|
||||
_switchResult = CompletionItemKind.File;
|
||||
break;
|
||||
case ContentAssistEntry.KIND_FUNCTION:
|
||||
_switchResult = CompletionItem.KIND_FUNCTION;
|
||||
_switchResult = CompletionItemKind.Function;
|
||||
break;
|
||||
case ContentAssistEntry.KIND_INTERFACE:
|
||||
_switchResult = CompletionItem.KIND_INTERFACE;
|
||||
_switchResult = CompletionItemKind.Interface;
|
||||
break;
|
||||
case ContentAssistEntry.KIND_KEYWORD:
|
||||
_switchResult = CompletionItem.KIND_KEYWORD;
|
||||
_switchResult = CompletionItemKind.Keyword;
|
||||
break;
|
||||
case ContentAssistEntry.KIND_METHOD:
|
||||
_switchResult = CompletionItem.KIND_METHOD;
|
||||
_switchResult = CompletionItemKind.Method;
|
||||
break;
|
||||
case ContentAssistEntry.KIND_MODULE:
|
||||
_switchResult = CompletionItem.KIND_MODULE;
|
||||
_switchResult = CompletionItemKind.Module;
|
||||
break;
|
||||
case ContentAssistEntry.KIND_PROPERTY:
|
||||
_switchResult = CompletionItem.KIND_PROPERTY;
|
||||
_switchResult = CompletionItemKind.Property;
|
||||
break;
|
||||
case ContentAssistEntry.KIND_REFERENCE:
|
||||
_switchResult = CompletionItem.KIND_REFERENCE;
|
||||
_switchResult = CompletionItemKind.Reference;
|
||||
break;
|
||||
case ContentAssistEntry.KIND_SNIPPET:
|
||||
_switchResult = CompletionItem.KIND_SNIPPET;
|
||||
_switchResult = CompletionItemKind.Snippet;
|
||||
break;
|
||||
case ContentAssistEntry.KIND_TEXT:
|
||||
_switchResult = CompletionItem.KIND_TEXT;
|
||||
_switchResult = CompletionItemKind.Text;
|
||||
break;
|
||||
case ContentAssistEntry.KIND_UNIT:
|
||||
_switchResult = CompletionItem.KIND_UNIT;
|
||||
_switchResult = CompletionItemKind.Unit;
|
||||
break;
|
||||
case ContentAssistEntry.KIND_VALUE:
|
||||
_switchResult = CompletionItem.KIND_VALUE;
|
||||
_switchResult = CompletionItemKind.Value;
|
||||
break;
|
||||
case ContentAssistEntry.KIND_VARIABLE:
|
||||
_switchResult = CompletionItem.KIND_VARIABLE;
|
||||
_switchResult = CompletionItemKind.Variable;
|
||||
break;
|
||||
default:
|
||||
_switchResult = CompletionItem.KIND_VALUE;
|
||||
_switchResult = CompletionItemKind.Value;
|
||||
break;
|
||||
}
|
||||
return _switchResult;
|
||||
|
|
|
@ -14,6 +14,7 @@ import io.typefox.lsapi.Location;
|
|||
import io.typefox.lsapi.LocationImpl;
|
||||
import io.typefox.lsapi.SymbolInformation;
|
||||
import io.typefox.lsapi.SymbolInformationImpl;
|
||||
import io.typefox.lsapi.SymbolKind;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.LinkedHashMap;
|
||||
|
@ -169,7 +170,7 @@ public class DocumentSymbolService {
|
|||
}
|
||||
final SymbolInformationImpl symbol = new SymbolInformationImpl();
|
||||
symbol.setName(symbolName);
|
||||
int _symbolKind = this.getSymbolKind(object);
|
||||
SymbolKind _symbolKind = this.getSymbolKind(object);
|
||||
symbol.setKind(_symbolKind);
|
||||
LocationImpl _newLocation = this._documentExtensions.newLocation(object);
|
||||
symbol.setLocation(_newLocation);
|
||||
|
@ -181,7 +182,7 @@ public class DocumentSymbolService {
|
|||
return this.getSymbolName(_fullyQualifiedName);
|
||||
}
|
||||
|
||||
protected int getSymbolKind(final EObject object) {
|
||||
protected SymbolKind getSymbolKind(final EObject object) {
|
||||
EClass _eClass = object.eClass();
|
||||
return this.getSymbolKind(_eClass);
|
||||
}
|
||||
|
@ -225,7 +226,7 @@ public class DocumentSymbolService {
|
|||
}
|
||||
final SymbolInformationImpl symbol = new SymbolInformationImpl();
|
||||
symbol.setName(symbolName);
|
||||
int _symbolKind = this.getSymbolKind(description);
|
||||
SymbolKind _symbolKind = this.getSymbolKind(description);
|
||||
symbol.setKind(_symbolKind);
|
||||
return symbol;
|
||||
}
|
||||
|
@ -235,7 +236,7 @@ public class DocumentSymbolService {
|
|||
return this.getSymbolName(_qualifiedName);
|
||||
}
|
||||
|
||||
protected int getSymbolKind(final IEObjectDescription description) {
|
||||
protected SymbolKind getSymbolKind(final IEObjectDescription description) {
|
||||
EClass _eClass = description.getEClass();
|
||||
return this.getSymbolKind(_eClass);
|
||||
}
|
||||
|
@ -248,8 +249,8 @@ public class DocumentSymbolService {
|
|||
return _string;
|
||||
}
|
||||
|
||||
protected int getSymbolKind(final EClass type) {
|
||||
return 0;
|
||||
protected SymbolKind getSymbolKind(final EClass type) {
|
||||
return SymbolKind.Property;
|
||||
}
|
||||
|
||||
protected void doRead(final IReferenceFinder.IResourceAccess resourceAccess, final URI objectURI, final Procedure1<? super EObject> acceptor) {
|
||||
|
|
|
@ -169,7 +169,7 @@ abstract class AbstractLanguageServerTest implements Consumer<PublishDiagnostics
|
|||
|
||||
protected def dispatch String toExpectation(SymbolInformation it) '''
|
||||
symbol "«name»" {
|
||||
kind: «kind»
|
||||
kind: «kind.value»
|
||||
location: «location.toExpectation»
|
||||
«IF !container.nullOrEmpty»
|
||||
container: "«container»"
|
||||
|
|
|
@ -31,6 +31,7 @@ import io.typefox.lsapi.Range;
|
|||
import io.typefox.lsapi.ReferenceContextImpl;
|
||||
import io.typefox.lsapi.ReferenceParamsImpl;
|
||||
import io.typefox.lsapi.SymbolInformation;
|
||||
import io.typefox.lsapi.SymbolKind;
|
||||
import io.typefox.lsapi.TextDocumentPositionParamsImpl;
|
||||
import io.typefox.lsapi.TextEdit;
|
||||
import io.typefox.lsapi.WorkspaceSymbolParamsImpl;
|
||||
|
@ -288,8 +289,9 @@ public abstract class AbstractLanguageServerTest implements Consumer<PublishDiag
|
|||
_builder.newLineIfNotEmpty();
|
||||
_builder.append(" ");
|
||||
_builder.append("kind: ");
|
||||
int _kind = it.getKind();
|
||||
_builder.append(_kind, " ");
|
||||
SymbolKind _kind = it.getKind();
|
||||
int _value = _kind.getValue();
|
||||
_builder.append(_value, " ");
|
||||
_builder.newLineIfNotEmpty();
|
||||
_builder.append(" ");
|
||||
_builder.append("location: ");
|
||||
|
|
Loading…
Reference in a new issue