diff --git a/assembly/assembly-ide-war/pom.xml b/assembly/assembly-ide-war/pom.xml index 444a322b026..638b34a5643 100644 --- a/assembly/assembly-ide-war/pom.xml +++ b/assembly/assembly-ide-war/pom.xml @@ -152,6 +152,14 @@ org.eclipse.che.plugin che-plugin-java-plain-shared + + org.eclipse.che.plugin + che-plugin-languageserver-ide + + + org.eclipse.che.plugin + che-plugin-languageserver-shared + org.eclipse.che.plugin che-plugin-machine-ext-client diff --git a/assembly/assembly-ide-war/src/main/resources/org/eclipse/che/ide/IDE.gwt.xml b/assembly/assembly-ide-war/src/main/resources/org/eclipse/che/ide/IDE.gwt.xml index 3a745693ff6..450f2c04c15 100644 --- a/assembly/assembly-ide-war/src/main/resources/org/eclipse/che/ide/IDE.gwt.xml +++ b/assembly/assembly-ide-war/src/main/resources/org/eclipse/che/ide/IDE.gwt.xml @@ -64,6 +64,7 @@ + diff --git a/assembly/assembly-wsagent-war/pom.xml b/assembly/assembly-wsagent-war/pom.xml index 515d8174afc..8ee88f69003 100644 --- a/assembly/assembly-wsagent-war/pom.xml +++ b/assembly/assembly-wsagent-war/pom.xml @@ -145,6 +145,14 @@ org.eclipse.che.plugin che-plugin-java-plain-shared + + org.eclipse.che.plugin + che-plugin-languageserver-server + + + org.eclipse.che.plugin + che-plugin-languageserver-shared + org.eclipse.che.plugin che-plugin-maven-generator-archetype diff --git a/plugins/plugin-languageserver/che-plugin-languageserver-ide/pom.xml b/plugins/plugin-languageserver/che-plugin-languageserver-ide/pom.xml new file mode 100644 index 00000000000..620f5130fd1 --- /dev/null +++ b/plugins/plugin-languageserver/che-plugin-languageserver-ide/pom.xml @@ -0,0 +1,67 @@ + + + + 4.0.0 + + che-plugin-languageserver-parent + org.eclipse.che.plugin + 4.3.0-RC1-SNAPSHOT + .. + + che-plugin-languageserver-ide + jar + Che Plugin :: Language Server :: IDE + + + com.google.guava + guava + + + com.google.gwt.inject + gin + + + com.google.inject + guice + + + javax.inject + javax.inject + + + org.eclipse.che.core + che-core-commons-gwt + + + org.eclipse.che.core + che-core-ide-api + + + org.eclipse.che.plugin + che-plugin-languageserver-shared + + + org.vectomatic + lib-gwt-svg + + + com.google.gwt + gwt-user + provided + + + + + + src/main/java + + + src/main/resources + + + + diff --git a/plugins/plugin-languageserver/che-plugin-languageserver-ide/src/main/java/org/eclipse/che/plugin/languageserver/ide/LanguageServerExtension.java b/plugins/plugin-languageserver/che-plugin-languageserver-ide/src/main/java/org/eclipse/che/plugin/languageserver/ide/LanguageServerExtension.java new file mode 100644 index 00000000000..df450b2396f --- /dev/null +++ b/plugins/plugin-languageserver/che-plugin-languageserver-ide/src/main/java/org/eclipse/che/plugin/languageserver/ide/LanguageServerExtension.java @@ -0,0 +1,67 @@ +package org.eclipse.che.plugin.languageserver.ide; + +import org.eclipse.che.ide.api.editor.EditorRegistry; +import org.eclipse.che.ide.api.event.FileEvent; +import org.eclipse.che.ide.api.event.FileEventHandler; +import org.eclipse.che.ide.api.extension.Extension; +import org.eclipse.che.ide.api.filetypes.FileType; +import org.eclipse.che.ide.api.filetypes.FileTypeRegistry; +import org.eclipse.che.plugin.languageserver.ide.editor.LanguageServerEditorConfiguration; +import org.eclipse.che.plugin.languageserver.ide.editor.LanguageServerEditorProvider; +import org.eclipse.che.plugin.languageserver.ide.service.TextDocumentServiceClient; +import org.eclipse.che.plugin.languageserver.shared.dto.DtoClientImpls; +import org.eclipse.che.plugin.languageserver.shared.dto.DtoClientImpls.DidCloseTextDocumentParamsDTOImpl; +import org.eclipse.che.plugin.languageserver.shared.dto.DtoClientImpls.DidOpenTextDocumentParamsDTOImpl; +import org.eclipse.che.plugin.languageserver.shared.dto.DtoClientImpls.DidSaveTextDocumentParamsDTOImpl; +import org.eclipse.che.plugin.languageserver.shared.dto.DtoClientImpls.TextDocumentIdentifierDTOImpl; +import org.eclipse.che.plugin.languageserver.shared.dto.DtoClientImpls.TextDocumentItemDTOImpl; + +import com.google.inject.Inject; +import com.google.web.bindery.event.shared.EventBus; + +@Extension(title = "LanguageServer") +public class LanguageServerExtension { + + @Inject + protected void configureFileTypes(FileTypeRegistry fileTypeRegistry, LanguageServerResources resources, + final EditorRegistry editorRegistry, final LanguageServerEditorProvider editorProvider) { + // TODO the file types need to be retrieved from the server. Ideally we + // would listen on messages when new language servers get registered. + FileType fileType = new FileType(resources.file(), "foo"); + fileTypeRegistry.registerFileType(fileType); + // register editor provider + editorRegistry.registerDefaultEditor(fileType, editorProvider); + } + + @Inject protected void registerFileEventHandler(EventBus eventBus, final TextDocumentServiceClient serviceClient) { + eventBus.addHandler(FileEvent.TYPE, new FileEventHandler() { + + @Override + public void onFileOperation(FileEvent event) { + TextDocumentIdentifierDTOImpl documentId = DtoClientImpls.TextDocumentIdentifierDTOImpl.make(); + documentId.setUri(event.getFile().getPath()); + switch (event.getOperationType()) { + case OPEN: + DidOpenTextDocumentParamsDTOImpl openEvent = DtoClientImpls.DidOpenTextDocumentParamsDTOImpl.make(); + TextDocumentItemDTOImpl documentItem = DtoClientImpls.TextDocumentItemDTOImpl.make(); + documentItem.setUri(event.getFile().getPath()); + documentItem.setVersion(LanguageServerEditorConfiguration.INITIAL_DOCUMENT_VERSION); + //TODO send text? + openEvent.setTextDocument(documentItem); + serviceClient.didOpen(openEvent); + break; + case CLOSE: + DidCloseTextDocumentParamsDTOImpl closeEvent = DtoClientImpls.DidCloseTextDocumentParamsDTOImpl.make(); + closeEvent.setTextDocument(documentId); + serviceClient.didClose(closeEvent); + break; + case SAVE: + DidSaveTextDocumentParamsDTOImpl saveEvent = DtoClientImpls.DidSaveTextDocumentParamsDTOImpl.make(); + saveEvent.setTextDocument(documentId); + serviceClient.didSave(saveEvent); + break; + } + } + }); + } +} diff --git a/plugins/plugin-languageserver/che-plugin-languageserver-ide/src/main/java/org/eclipse/che/plugin/languageserver/ide/LanguageServerResources.java b/plugins/plugin-languageserver/che-plugin-languageserver-ide/src/main/java/org/eclipse/che/plugin/languageserver/ide/LanguageServerResources.java new file mode 100644 index 00000000000..780f8e19ab8 --- /dev/null +++ b/plugins/plugin-languageserver/che-plugin-languageserver-ide/src/main/java/org/eclipse/che/plugin/languageserver/ide/LanguageServerResources.java @@ -0,0 +1,16 @@ +package org.eclipse.che.plugin.languageserver.ide; + +import com.google.gwt.core.client.GWT; +import com.google.gwt.resources.client.ClientBundle; + +import org.vectomatic.dom.svg.ui.SVGResource; + +public interface LanguageServerResources extends ClientBundle { + LanguageServerResources INSTANCE = GWT.create(LanguageServerResources.class); + + @Source("svg/file.svg") + SVGResource file(); + + @Source("svg/category.svg") + SVGResource category(); +} diff --git a/plugins/plugin-languageserver/che-plugin-languageserver-ide/src/main/java/org/eclipse/che/plugin/languageserver/ide/editor/LanguageServerEditorConfiguration.java b/plugins/plugin-languageserver/che-plugin-languageserver-ide/src/main/java/org/eclipse/che/plugin/languageserver/ide/editor/LanguageServerEditorConfiguration.java new file mode 100644 index 00000000000..fa60f1b221e --- /dev/null +++ b/plugins/plugin-languageserver/che-plugin-languageserver-ide/src/main/java/org/eclipse/che/plugin/languageserver/ide/editor/LanguageServerEditorConfiguration.java @@ -0,0 +1,107 @@ +package org.eclipse.che.plugin.languageserver.ide.editor; + +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.atomic.AtomicInteger; + +import org.eclipse.che.ide.api.editor.annotation.AnnotationModel; +import org.eclipse.che.ide.api.editor.annotation.AnnotationModelImpl; +import org.eclipse.che.ide.api.editor.codeassist.CodeAssistProcessor; +import org.eclipse.che.ide.api.editor.document.Document; +import org.eclipse.che.ide.api.editor.editorconfig.DefaultTextEditorConfiguration; +import org.eclipse.che.ide.api.editor.events.DocumentChangeEvent; +import org.eclipse.che.ide.api.editor.partition.ConstantPartitioner; +import org.eclipse.che.ide.api.editor.partition.DocumentPartitioner; +import org.eclipse.che.ide.api.editor.partition.DocumentPositionMap; +import org.eclipse.che.ide.api.editor.reconciler.Reconciler; +import org.eclipse.che.ide.api.editor.reconciler.ReconcilerWithAutoSave; +import org.eclipse.che.ide.api.editor.text.TextPosition; +import org.eclipse.che.plugin.languageserver.ide.editor.codeassist.LanguageServerCodeAssistProcessor; +import org.eclipse.che.plugin.languageserver.ide.service.TextDocumentServiceClient; +import org.eclipse.che.plugin.languageserver.shared.dto.DtoClientImpls; +import org.eclipse.che.plugin.languageserver.shared.dto.DtoClientImpls.DidChangeTextDocumentParamsDTOImpl; +import org.eclipse.che.plugin.languageserver.shared.dto.DtoClientImpls.PositionDTOImpl; +import org.eclipse.che.plugin.languageserver.shared.dto.DtoClientImpls.RangeDTOImpl; +import org.eclipse.che.plugin.languageserver.shared.dto.DtoClientImpls.TextDocumentContentChangeEventDTOImpl; +import org.eclipse.che.plugin.languageserver.shared.dto.DtoClientImpls.VersionedTextDocumentIdentifierDTOImpl; + +import com.google.inject.Inject; +import com.google.inject.Provider; + +public class LanguageServerEditorConfiguration extends DefaultTextEditorConfiguration { + + public static final int INITIAL_DOCUMENT_VERSION = 0; + + private final LanguageServerCodeAssistProcessor codeAssistProcessor; + private final AnnotationModel annotationModel; + private final DocumentPositionMap documentPositionMap; + private final AtomicInteger version = new AtomicInteger(INITIAL_DOCUMENT_VERSION); + private final ConstantPartitioner constantPartitioner; + private final ReconcilerWithAutoSave reconciler; + + @Inject + public LanguageServerEditorConfiguration(final LanguageServerCodeAssistProcessor codeAssistProcessor, final Provider docPositionMapProvider, final TextDocumentServiceClient textDocumentService) { + this.codeAssistProcessor = codeAssistProcessor; + this.documentPositionMap = docPositionMapProvider.get(); + this.annotationModel = new AnnotationModelImpl(documentPositionMap); + + //HACK hijacked the partitioner to get document change events + this.constantPartitioner = new ConstantPartitioner() { + + @Override + public void onDocumentChange(DocumentChangeEvent event) { + super.onDocumentChange(event); + + Document document = event.getDocument().getDocument(); + TextPosition startPosition = document.getPositionFromIndex(event.getOffset()); + TextPosition endPosition = document.getPositionFromIndex(event.getOffset() + event.getLength()); + + DidChangeTextDocumentParamsDTOImpl changeDTO = DtoClientImpls.DidChangeTextDocumentParamsDTOImpl.make(); + String uri = ((Document) document).getFile().getPath(); + changeDTO.setUri(uri); + VersionedTextDocumentIdentifierDTOImpl versionedDocId = DtoClientImpls.VersionedTextDocumentIdentifierDTOImpl.make(); + versionedDocId.setUri(uri); + versionedDocId.setVersion(version.incrementAndGet()); + changeDTO.setTextDocument(versionedDocId); + TextDocumentContentChangeEventDTOImpl actualChange = DtoClientImpls.TextDocumentContentChangeEventDTOImpl.make(); + RangeDTOImpl range = DtoClientImpls.RangeDTOImpl.make(); + PositionDTOImpl start = DtoClientImpls.PositionDTOImpl.make(); + start.setLine(startPosition.getLine()); + start.setCharacter(startPosition.getCharacter()); + PositionDTOImpl end = DtoClientImpls.PositionDTOImpl.make(); + end.setLine(endPosition.getLine()); + end.setCharacter(endPosition.getCharacter()); + range.setStart(start); + range.setEnd(end); + actualChange.setRange(range); + actualChange.setText(event.getText()); + changeDTO.addContentChanges(actualChange); + textDocumentService.didChange(changeDTO); + } + }; + this.reconciler = new ReconcilerWithAutoSave(DocumentPartitioner.DEFAULT_CONTENT_TYPE, constantPartitioner); + } + + @Override + public Map getContentAssistantProcessors() { + Map map = new HashMap<>(); + map.put(DocumentPartitioner.DEFAULT_CONTENT_TYPE, codeAssistProcessor); + return map; + } + + @Override + public AnnotationModel getAnnotationModel() { + return annotationModel; + } + + @Override + public DocumentPartitioner getPartitioner() { + return constantPartitioner; + } + + @Override + public Reconciler getReconciler() { + return reconciler; + } + +} diff --git a/plugins/plugin-languageserver/che-plugin-languageserver-ide/src/main/java/org/eclipse/che/plugin/languageserver/ide/editor/LanguageServerEditorProvider.java b/plugins/plugin-languageserver/che-plugin-languageserver-ide/src/main/java/org/eclipse/che/plugin/languageserver/ide/editor/LanguageServerEditorProvider.java new file mode 100644 index 00000000000..1ec899219e0 --- /dev/null +++ b/plugins/plugin-languageserver/che-plugin-languageserver-ide/src/main/java/org/eclipse/che/plugin/languageserver/ide/editor/LanguageServerEditorProvider.java @@ -0,0 +1,33 @@ +package org.eclipse.che.plugin.languageserver.ide.editor; + +import javax.inject.Inject; + +import org.eclipse.che.ide.api.editor.defaulteditor.AbstractTextEditorProvider; +import org.eclipse.che.ide.api.editor.editorconfig.TextEditorConfiguration; + +import com.google.inject.Provider; + +public class LanguageServerEditorProvider extends AbstractTextEditorProvider { + + private Provider editorConfigurationProvider; + + @Inject + public LanguageServerEditorProvider(final Provider editorConfigurationProvider) { + this.editorConfigurationProvider = editorConfigurationProvider; + } + + @Override + public String getId() { + return "LanguageServerEditor"; + } + + @Override + public String getDescription() { + return "Code Editor"; + } + + @Override + protected TextEditorConfiguration getEditorConfiguration() { + return editorConfigurationProvider.get(); + } +} diff --git a/plugins/plugin-languageserver/che-plugin-languageserver-ide/src/main/java/org/eclipse/che/plugin/languageserver/ide/editor/PublishDiagnosticsProcessor.java b/plugins/plugin-languageserver/che-plugin-languageserver-ide/src/main/java/org/eclipse/che/plugin/languageserver/ide/editor/PublishDiagnosticsProcessor.java new file mode 100644 index 00000000000..f29df64865c --- /dev/null +++ b/plugins/plugin-languageserver/che-plugin-languageserver-ide/src/main/java/org/eclipse/che/plugin/languageserver/ide/editor/PublishDiagnosticsProcessor.java @@ -0,0 +1,58 @@ +package org.eclipse.che.plugin.languageserver.ide.editor; + +import org.eclipse.che.ide.api.editor.EditorAgent; +import org.eclipse.che.ide.api.editor.EditorPartPresenter; +import org.eclipse.che.ide.api.editor.annotation.AnnotationModel; +import org.eclipse.che.ide.api.editor.document.Document; +import org.eclipse.che.ide.api.editor.editorconfig.TextEditorConfiguration; +import org.eclipse.che.ide.api.editor.text.Position; +import org.eclipse.che.ide.api.editor.text.TextPosition; +import org.eclipse.che.ide.api.editor.text.annotation.Annotation; +import org.eclipse.che.ide.api.editor.texteditor.TextEditor; +import org.eclipse.che.ide.resource.Path; +import org.eclipse.che.plugin.languageserver.shared.lsapi.DiagnosticDTO; +import org.eclipse.che.plugin.languageserver.shared.lsapi.PublishDiagnosticsParamsDTO; +import org.eclipse.che.plugin.languageserver.shared.lsapi.RangeDTO; + +import com.google.inject.Inject; +import com.google.inject.Singleton; + +import io.typefox.lsapi.Diagnostic; + +@Singleton +public class PublishDiagnosticsProcessor { + + private final EditorAgent editorAgent; + + @Inject + public PublishDiagnosticsProcessor(EditorAgent editorAgent) { + this.editorAgent = editorAgent; + } + + public void processDiagnostics(PublishDiagnosticsParamsDTO diagnosticsMessage) { + EditorPartPresenter openedEditor = editorAgent.getOpenedEditor(new Path(diagnosticsMessage.getUri())); + //TODO add markers + if (openedEditor == null) + return; + if (openedEditor instanceof TextEditor) { + TextEditorConfiguration editorConfiguration = ((TextEditor) openedEditor).getConfiguration(); + AnnotationModel annotationModel = editorConfiguration.getAnnotationModel(); + if (annotationModel != null) { + annotationModel.clear(); + Document document = ((TextEditor) openedEditor).getDocument(); + for (DiagnosticDTO diagnostic : diagnosticsMessage.getDiagnostics()) { + Annotation annotation = new Annotation(true); + annotation.setText(diagnostic.getMessage()); + // TODO generalize id for error and warning. Needs fix in org.eclipse.che.ide.editor.orion.client.OrionEditorWidget.getSeverity(String) + annotation.setType(diagnostic.getSeverity() == Diagnostic.SEVERITY_ERROR ? "org.eclipse.jdt.ui.error" : "org.eclipse.jdt.ui.warning"); + + RangeDTO range = diagnostic.getRange(); + int startIndex = document.getIndexFromPosition(new TextPosition(range.getStart().getLine(), range.getStart().getCharacter())); + int endIndex = document.getIndexFromPosition(new TextPosition(range.getEnd().getLine(), range.getEnd().getCharacter())); + annotationModel.addAnnotation(annotation, new Position(startIndex, endIndex - startIndex)); + } + } + } + } + +} diff --git a/plugins/plugin-languageserver/che-plugin-languageserver-ide/src/main/java/org/eclipse/che/plugin/languageserver/ide/editor/codeassist/CompletionItemBasedCompletionProposal.java b/plugins/plugin-languageserver/che-plugin-languageserver-ide/src/main/java/org/eclipse/che/plugin/languageserver/ide/editor/codeassist/CompletionItemBasedCompletionProposal.java new file mode 100644 index 00000000000..f9997595c20 --- /dev/null +++ b/plugins/plugin-languageserver/che-plugin-languageserver-ide/src/main/java/org/eclipse/che/plugin/languageserver/ide/editor/codeassist/CompletionItemBasedCompletionProposal.java @@ -0,0 +1,71 @@ +package org.eclipse.che.plugin.languageserver.ide.editor.codeassist; + +import org.eclipse.che.ide.api.editor.codeassist.Completion; +import org.eclipse.che.ide.api.editor.codeassist.CompletionProposal; +import org.eclipse.che.ide.api.editor.document.Document; +import org.eclipse.che.ide.api.editor.text.LinearRange; +import org.eclipse.che.ide.api.editor.text.TextPosition; +import org.eclipse.che.ide.api.icon.Icon; +import org.eclipse.che.plugin.languageserver.shared.lsapi.CompletionItemDTO; +import org.eclipse.che.plugin.languageserver.shared.lsapi.RangeDTO; + +import com.google.gwt.user.client.ui.Widget; + +class CompletionItemBasedCompletionProposal implements CompletionProposal { + + private CompletionItemDTO completionItem; + + CompletionItemBasedCompletionProposal(CompletionItemDTO completionItem) { + this.completionItem = completionItem; + } + + @Override + public Widget getAdditionalProposalInfo() { + return null; + } + + @Override + public String getDisplayString() { + return completionItem.getLabel(); + } + + @Override + public Icon getIcon() { + return null; + } + + @Override + public void getCompletion(CompletionCallback callback) { + callback.onCompletion(new CompletionImpl(completionItem)); + } + + private static class CompletionImpl implements Completion { + + private CompletionItemDTO completionItem; + + public CompletionImpl(CompletionItemDTO completionItem) { + this.completionItem = completionItem; + } + + @Override + public void apply(Document document) { + RangeDTO range = completionItem.getTextEdit().getRange(); + int startOffset = document.getIndexFromPosition( + new TextPosition(range.getStart().getLine(), range.getStart().getCharacter())); + int endOffset = document + .getIndexFromPosition(new TextPosition(range.getEnd().getLine(), range.getEnd().getCharacter())); + document.replace(startOffset, endOffset - startOffset, completionItem.getTextEdit().getNewText()); + } + + @Override + public LinearRange getSelection(Document document) { + RangeDTO range = completionItem.getTextEdit().getRange(); + int startOffset = document + .getIndexFromPosition(new TextPosition(range.getStart().getLine(), range.getStart().getCharacter())) + + completionItem.getTextEdit().getNewText().length(); + return LinearRange.createWithStart(startOffset).andLength(0); + } + + } + +} diff --git a/plugins/plugin-languageserver/che-plugin-languageserver-ide/src/main/java/org/eclipse/che/plugin/languageserver/ide/editor/codeassist/LanguageServerCodeAssistProcessor.java b/plugins/plugin-languageserver/che-plugin-languageserver-ide/src/main/java/org/eclipse/che/plugin/languageserver/ide/editor/codeassist/LanguageServerCodeAssistProcessor.java new file mode 100644 index 00000000000..964ee3eef6c --- /dev/null +++ b/plugins/plugin-languageserver/che-plugin-languageserver-ide/src/main/java/org/eclipse/che/plugin/languageserver/ide/editor/codeassist/LanguageServerCodeAssistProcessor.java @@ -0,0 +1,71 @@ +package org.eclipse.che.plugin.languageserver.ide.editor.codeassist; + +import static com.google.common.collect.Lists.newArrayList; + +import java.util.List; + +import org.eclipse.che.api.promises.client.Operation; +import org.eclipse.che.api.promises.client.OperationException; +import org.eclipse.che.api.promises.client.PromiseError; +import org.eclipse.che.ide.api.editor.codeassist.CodeAssistCallback; +import org.eclipse.che.ide.api.editor.codeassist.CodeAssistProcessor; +import org.eclipse.che.ide.api.editor.codeassist.CompletionProposal; +import org.eclipse.che.ide.api.editor.text.TextPosition; +import org.eclipse.che.ide.api.editor.texteditor.TextEditor; +import org.eclipse.che.plugin.languageserver.ide.service.TextDocumentServiceClient; +import org.eclipse.che.plugin.languageserver.shared.dto.DtoClientImpls; +import org.eclipse.che.plugin.languageserver.shared.dto.DtoClientImpls.PositionDTOImpl; +import org.eclipse.che.plugin.languageserver.shared.dto.DtoClientImpls.TextDocumentIdentifierDTOImpl; +import org.eclipse.che.plugin.languageserver.shared.dto.DtoClientImpls.TextDocumentPositionParamsDTOImpl; +import org.eclipse.che.plugin.languageserver.shared.lsapi.CompletionItemDTO; + +import com.google.inject.Inject; + +public class LanguageServerCodeAssistProcessor implements CodeAssistProcessor { + + private TextDocumentServiceClient documentServiceClient; + + @Inject + public LanguageServerCodeAssistProcessor(TextDocumentServiceClient documentServiceClient) { + this.documentServiceClient = documentServiceClient; + } + + @Override + public void computeCompletionProposals(TextEditor editor, int offset, final CodeAssistCallback callback) { + TextDocumentPositionParamsDTOImpl documentPosition = DtoClientImpls.TextDocumentPositionParamsDTOImpl.make(); + documentPosition.setUri(editor.getEditorInput().getFile().getContentUrl()); + PositionDTOImpl position = DtoClientImpls.PositionDTOImpl.make(); + TextPosition textPos = editor.getDocument().getPositionFromIndex(offset); + position.setCharacter(textPos.getCharacter()); + position.setLine(textPos.getLine()); + documentPosition.setPosition(position); + TextDocumentIdentifierDTOImpl documentId = DtoClientImpls.TextDocumentIdentifierDTOImpl.make(); + documentId.setUri(editor.getEditorInput().getFile().getContentUrl()); + documentPosition.setTextDocument(documentId); + this.lastErrorMessage = null; + documentServiceClient.completion(documentPosition).then(new Operation>() { + + @Override + public void apply(List items) throws OperationException { + List proposals = newArrayList(); + for (CompletionItemDTO item : items) { + proposals.add(new CompletionItemBasedCompletionProposal(item)); + } + callback.proposalComputed(proposals); + } + }).catchError(new Operation() { + @Override + public void apply(PromiseError error) throws OperationException { + lastErrorMessage = error.getMessage(); + } + }); + } + + private String lastErrorMessage; + + @Override + public String getErrorMessage() { + return lastErrorMessage; + } + +} diff --git a/plugins/plugin-languageserver/che-plugin-languageserver-ide/src/main/java/org/eclipse/che/plugin/languageserver/ide/inject/LanguageServerGinModule.java b/plugins/plugin-languageserver/che-plugin-languageserver-ide/src/main/java/org/eclipse/che/plugin/languageserver/ide/inject/LanguageServerGinModule.java new file mode 100644 index 00000000000..51d8d0f79a7 --- /dev/null +++ b/plugins/plugin-languageserver/che-plugin-languageserver-ide/src/main/java/org/eclipse/che/plugin/languageserver/ide/inject/LanguageServerGinModule.java @@ -0,0 +1,14 @@ +package org.eclipse.che.plugin.languageserver.ide.inject; + +import org.eclipse.che.ide.api.extension.ExtensionGinModule; + +import com.google.gwt.inject.client.AbstractGinModule; + +@ExtensionGinModule +public class LanguageServerGinModule extends AbstractGinModule { + + @Override + protected void configure() { + } + +} diff --git a/plugins/plugin-languageserver/che-plugin-languageserver-ide/src/main/java/org/eclipse/che/plugin/languageserver/ide/service/TextDocumentServiceClient.java b/plugins/plugin-languageserver/che-plugin-languageserver-ide/src/main/java/org/eclipse/che/plugin/languageserver/ide/service/TextDocumentServiceClient.java new file mode 100644 index 00000000000..052045e0cf9 --- /dev/null +++ b/plugins/plugin-languageserver/che-plugin-languageserver-ide/src/main/java/org/eclipse/che/plugin/languageserver/ide/service/TextDocumentServiceClient.java @@ -0,0 +1,152 @@ +package org.eclipse.che.plugin.languageserver.ide.service; + +import static org.eclipse.che.ide.MimeType.APPLICATION_JSON; +import static org.eclipse.che.ide.rest.HTTPHeader.ACCEPT; +import static org.eclipse.che.ide.rest.HTTPHeader.CONTENT_TYPE; + +import java.util.List; + +import org.eclipse.che.api.promises.client.Operation; +import org.eclipse.che.api.promises.client.OperationException; +import org.eclipse.che.api.promises.client.Promise; +import org.eclipse.che.ide.api.app.AppContext; +import org.eclipse.che.ide.api.machine.WsAgentStateController; +import org.eclipse.che.ide.api.notification.NotificationManager; +import org.eclipse.che.ide.api.notification.StatusNotification; +import org.eclipse.che.ide.dto.JsonSerializable; +import org.eclipse.che.ide.rest.AsyncRequestFactory; +import org.eclipse.che.ide.rest.DtoUnmarshallerFactory; +import org.eclipse.che.ide.rest.Unmarshallable; +import org.eclipse.che.ide.util.loging.Log; +import org.eclipse.che.ide.websocket.MessageBus; +import org.eclipse.che.ide.websocket.WebSocketException; +import org.eclipse.che.ide.websocket.rest.SubscriptionHandler; +import org.eclipse.che.plugin.languageserver.ide.editor.PublishDiagnosticsProcessor; +import org.eclipse.che.plugin.languageserver.shared.lsapi.CompletionItemDTO; +import org.eclipse.che.plugin.languageserver.shared.lsapi.DidChangeTextDocumentParamsDTO; +import org.eclipse.che.plugin.languageserver.shared.lsapi.DidCloseTextDocumentParamsDTO; +import org.eclipse.che.plugin.languageserver.shared.lsapi.DidOpenTextDocumentParamsDTO; +import org.eclipse.che.plugin.languageserver.shared.lsapi.DidSaveTextDocumentParamsDTO; +import org.eclipse.che.plugin.languageserver.shared.lsapi.PublishDiagnosticsParamsDTO; +import org.eclipse.che.plugin.languageserver.shared.lsapi.TextDocumentPositionParamsDTO; + +import com.google.inject.Inject; +import com.google.inject.Singleton; + +@Singleton +public class TextDocumentServiceClient { + + private final DtoUnmarshallerFactory unmarshallerFactory; + private final AsyncRequestFactory asyncRequestFactory; + private final AppContext appContext; + private final NotificationManager notificationManager; + private final PublishDiagnosticsProcessor publishDiagnosticsProcessor; + + @Inject + public TextDocumentServiceClient( + final DtoUnmarshallerFactory unmarshallerFactory, + final NotificationManager notificationManager, + final AppContext appContext, + final AsyncRequestFactory asyncRequestFactory, + final WsAgentStateController wsAgentStateController, + final PublishDiagnosticsProcessor publishDiagnosticsProcessor) { + this.unmarshallerFactory = unmarshallerFactory; + this.notificationManager = notificationManager; + this.appContext = appContext; + this.asyncRequestFactory = asyncRequestFactory; + this.publishDiagnosticsProcessor = publishDiagnosticsProcessor; + wsAgentStateController.getMessageBus().then(new Operation() { + @Override + public void apply(MessageBus arg) throws OperationException { + subscribeToPublishDiagnostics(arg); + } + }); + } + + /** + * GWT client implementation of {@link io.typefox.lsapi.TextDocumentService#completion(io.typefox.lsapi.TextDocumentPositionParams)} + * + * @param position + * @return + */ + public Promise> completion(TextDocumentPositionParamsDTO position) { + String requestUrl = appContext.getDevMachine().getWsAgentBaseUrl() + "/languageserver/textDocument/completion"; + Unmarshallable> unmarshaller = unmarshallerFactory + .newListUnmarshaller(CompletionItemDTO.class); + return asyncRequestFactory.createPostRequest(requestUrl, null).header(ACCEPT, APPLICATION_JSON) + .header(CONTENT_TYPE, APPLICATION_JSON).data(((JsonSerializable) position).toJson()).send(unmarshaller); + } + + /** + * GWT client implementation of {@link io.typefox.lsapi.TextDocumentService#didChange(io.typefox.lsapi.DidChangeTextDocumentParams)} + * + * @param change + * @return + */ + public void didChange(DidChangeTextDocumentParamsDTO change) { + String requestUrl = appContext.getDevMachine().getWsAgentBaseUrl() + "/languageserver/textDocument/didChange"; + asyncRequestFactory.createPostRequest(requestUrl, null).header(ACCEPT, APPLICATION_JSON) + .header(CONTENT_TYPE, APPLICATION_JSON).data(((JsonSerializable) change).toJson()).send(); + } + + /** + * GWT client implementation of {@link io.typefox.lsapi.TextDocumentService#didOpen(io.typefox.lsapi.DidOpenTextDocumentParams)} + * + * @param openEvent + * @return + */ + public void didOpen(DidOpenTextDocumentParamsDTO openEvent) { + String requestUrl = appContext.getDevMachine().getWsAgentBaseUrl() + "/languageserver/textDocument/didOpen"; + asyncRequestFactory.createPostRequest(requestUrl, null).header(ACCEPT, APPLICATION_JSON) + .header(CONTENT_TYPE, APPLICATION_JSON).data(((JsonSerializable) openEvent).toJson()).send(); + } + + /** + * GWT client implementation of {@link io.typefox.lsapi.TextDocumentService#didClose(io.typefox.lsapi.DidCloseTextDocumentParams)} + * + * @param closeEvent + * @return + */ + public void didClose(DidCloseTextDocumentParamsDTO closeEvent) { + String requestUrl = appContext.getDevMachine().getWsAgentBaseUrl() + "/languageserver/textDocument/didClose"; + asyncRequestFactory.createPostRequest(requestUrl, null).header(ACCEPT, APPLICATION_JSON) + .header(CONTENT_TYPE, APPLICATION_JSON).data(((JsonSerializable) closeEvent).toJson()).send(); + } + + /** + * GWT client implementation of {@link io.typefox.lsapi.TextDocumentService#didSave(io.typefox.lsapi.DidSaveTextDocumentParams)} + * + * @param saveEvent + * @return + */ + public void didSave(DidSaveTextDocumentParamsDTO saveEvent) { + String requestUrl = appContext.getDevMachine().getWsAgentBaseUrl() + "/languageserver/textDocument/didSave"; + asyncRequestFactory.createPostRequest(requestUrl, null).header(ACCEPT, APPLICATION_JSON) + .header(CONTENT_TYPE, APPLICATION_JSON).data(((JsonSerializable) saveEvent).toJson()).send(); + } + + /** + * Subscribes to websocket for 'textDocument/publishDiagnostics' notifications. + */ + private void subscribeToPublishDiagnostics(final MessageBus messageBus) { + org.eclipse.che.ide.websocket.rest.Unmarshallable unmarshaller = unmarshallerFactory.newWSUnmarshaller(PublishDiagnosticsParamsDTO.class); + try { + messageBus.subscribe("languageserver/textDocument/publishDiagnostics", + new SubscriptionHandler(unmarshaller) { + @Override + protected void onMessageReceived(PublishDiagnosticsParamsDTO statusEvent) { + publishDiagnosticsProcessor.processDiagnostics(statusEvent); + } + + @Override + protected void onErrorReceived(Throwable exception) { + notificationManager.notify(exception.getMessage(), StatusNotification.Status.FAIL, + StatusNotification.DisplayMode.NOT_EMERGE_MODE); + } + }); + } catch (WebSocketException exception) { + Log.error(getClass(), exception); + } + } + +} diff --git a/plugins/plugin-languageserver/che-plugin-languageserver-ide/src/main/resources/org/eclipse/che/plugin/languageserver/LanguageServer.gwt.xml b/plugins/plugin-languageserver/che-plugin-languageserver-ide/src/main/resources/org/eclipse/che/plugin/languageserver/LanguageServer.gwt.xml new file mode 100644 index 00000000000..9f686f960d3 --- /dev/null +++ b/plugins/plugin-languageserver/che-plugin-languageserver-ide/src/main/resources/org/eclipse/che/plugin/languageserver/LanguageServer.gwt.xml @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + diff --git a/plugins/plugin-languageserver/che-plugin-languageserver-ide/src/main/resources/org/eclipse/che/plugin/languageserver/ide/svg/category.svg b/plugins/plugin-languageserver/che-plugin-languageserver-ide/src/main/resources/org/eclipse/che/plugin/languageserver/ide/svg/category.svg new file mode 100644 index 00000000000..64d8186a3ee --- /dev/null +++ b/plugins/plugin-languageserver/che-plugin-languageserver-ide/src/main/resources/org/eclipse/che/plugin/languageserver/ide/svg/category.svg @@ -0,0 +1,31 @@ + + + + + + + + diff --git a/plugins/plugin-languageserver/che-plugin-languageserver-ide/src/main/resources/org/eclipse/che/plugin/languageserver/ide/svg/file.svg b/plugins/plugin-languageserver/che-plugin-languageserver-ide/src/main/resources/org/eclipse/che/plugin/languageserver/ide/svg/file.svg new file mode 100644 index 00000000000..64d8186a3ee --- /dev/null +++ b/plugins/plugin-languageserver/che-plugin-languageserver-ide/src/main/resources/org/eclipse/che/plugin/languageserver/ide/svg/file.svg @@ -0,0 +1,31 @@ + + + + + + + + diff --git a/plugins/plugin-languageserver/che-plugin-languageserver-server/pom.xml b/plugins/plugin-languageserver/che-plugin-languageserver-server/pom.xml new file mode 100644 index 00000000000..bedce8e37c3 --- /dev/null +++ b/plugins/plugin-languageserver/che-plugin-languageserver-server/pom.xml @@ -0,0 +1,73 @@ + + + + 4.0.0 + + che-plugin-languageserver-parent + org.eclipse.che.plugin + 4.3.0-RC1-SNAPSHOT + + che-plugin-languageserver-server + Che Plugin :: Language Server :: Server + + false + + + + com.google.code.gson + gson + + + com.google.guava + guava + + + com.google.inject + guice + + + io.typefox.lsapi + io.typefox.lsapi + + + javax.annotation + javax.annotation-api + + + javax.inject + javax.inject + + + javax.websocket + javax.websocket-api + + + javax.ws.rs + javax.ws.rs-api + + + org.eclipse.che.core + che-core-api-core + + + org.eclipse.che.core + che-core-commons-inject + + + org.eclipse.che.plugin + che-plugin-languageserver-shared + + + org.everrest + everrest-websockets + + + org.slf4j + slf4j-api + + + diff --git a/plugins/plugin-languageserver/che-plugin-languageserver-server/src/main/java/org/eclipse/che/plugin/languageserver/server/LanguageServerModule.java b/plugins/plugin-languageserver/che-plugin-languageserver-server/src/main/java/org/eclipse/che/plugin/languageserver/server/LanguageServerModule.java new file mode 100644 index 00000000000..dd96ae91f4c --- /dev/null +++ b/plugins/plugin-languageserver/che-plugin-languageserver-server/src/main/java/org/eclipse/che/plugin/languageserver/server/LanguageServerModule.java @@ -0,0 +1,22 @@ +package org.eclipse.che.plugin.languageserver.server; + +import org.eclipse.che.inject.DynaModule; +import org.eclipse.che.plugin.languageserver.server.dummyimpl.FooLanguageServer; +import org.eclipse.che.plugin.languageserver.server.lsapi.PublishDiagnosticsParamsMessenger; + +import com.google.inject.AbstractModule; + +@DynaModule +public class LanguageServerModule extends AbstractModule { + + @Override + protected void configure() { + // HACK LanguageServers should be registered dynamically or at least via + // some configuration. + bind(FooLanguageServer.class); + + bind(TextDocumentServiceImpl.class); + bind(PublishDiagnosticsParamsMessenger.class); + } + +} diff --git a/plugins/plugin-languageserver/che-plugin-languageserver-server/src/main/java/org/eclipse/che/plugin/languageserver/server/LanguageServerRegistry.java b/plugins/plugin-languageserver/che-plugin-languageserver-server/src/main/java/org/eclipse/che/plugin/languageserver/server/LanguageServerRegistry.java new file mode 100644 index 00000000000..5b3d6da829b --- /dev/null +++ b/plugins/plugin-languageserver/che-plugin-languageserver-server/src/main/java/org/eclipse/che/plugin/languageserver/server/LanguageServerRegistry.java @@ -0,0 +1,53 @@ +package org.eclipse.che.plugin.languageserver.server; + +import static com.google.common.collect.Maps.newHashMap; + +import java.util.Map; + +import org.eclipse.che.plugin.languageserver.server.lsapi.PublishDiagnosticsParamsMessenger; + +import com.google.inject.Inject; +import com.google.inject.Singleton; + +import io.typefox.lsapi.InitializeParamsImpl; +import io.typefox.lsapi.LanguageServer; +import io.typefox.lsapi.NotificationCallback; +import io.typefox.lsapi.PublishDiagnosticsParams; + +@Singleton +public class LanguageServerRegistry { + + private Map extensionToServer = newHashMap(); + private final PublishDiagnosticsParamsMessenger publishDiagnosticsMessenger; + + @Inject + public LanguageServerRegistry(PublishDiagnosticsParamsMessenger publishDiagnosticsMessenger) { + this.publishDiagnosticsMessenger = publishDiagnosticsMessenger; + } + + public LanguageServer findServer(String uri) { + int lastIndexOf = uri.lastIndexOf('.'); + if (lastIndexOf == -1) { + return null; + } + String extension = uri.substring(lastIndexOf + 1); + return extensionToServer.get(extension); + } + + public void registerForExtension(String extension, LanguageServer server) { + this.extensionToServer.put(extension, server); + server.initialize(new InitializeParamsImpl() { + { + //HACK hard coded properties + setProcessId(4711); + setRootPath("/projects/"); + } + }); + server.getTextDocumentService().onPublishDiagnostics(new NotificationCallback() { + @Override + public void call(PublishDiagnosticsParams param) { + publishDiagnosticsMessenger.onEvent(param); + } + }); + } +} diff --git a/plugins/plugin-languageserver/che-plugin-languageserver-server/src/main/java/org/eclipse/che/plugin/languageserver/server/TextDocumentServiceImpl.java b/plugins/plugin-languageserver/che-plugin-languageserver-server/src/main/java/org/eclipse/che/plugin/languageserver/server/TextDocumentServiceImpl.java new file mode 100644 index 00000000000..95db2b727dd --- /dev/null +++ b/plugins/plugin-languageserver/che-plugin-languageserver-server/src/main/java/org/eclipse/che/plugin/languageserver/server/TextDocumentServiceImpl.java @@ -0,0 +1,88 @@ +package org.eclipse.che.plugin.languageserver.server; + +import java.util.List; + +import javax.ws.rs.Consumes; +import javax.ws.rs.POST; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; +import javax.ws.rs.core.MediaType; + +import org.eclipse.che.plugin.languageserver.shared.lsapi.DidChangeTextDocumentParamsDTO; +import org.eclipse.che.plugin.languageserver.shared.lsapi.DidCloseTextDocumentParamsDTO; +import org.eclipse.che.plugin.languageserver.shared.lsapi.DidOpenTextDocumentParamsDTO; +import org.eclipse.che.plugin.languageserver.shared.lsapi.DidSaveTextDocumentParamsDTO; +import org.eclipse.che.plugin.languageserver.shared.lsapi.TextDocumentPositionParamsDTO; + +import com.google.inject.Inject; +import com.google.inject.Singleton; + +import io.typefox.lsapi.CompletionItem; +import io.typefox.lsapi.LanguageServer; + +/** + * REST API for the textDocument/* services defined in https://github.com/Microsoft/vscode-languageserver-protocol + * Dispatches onto the {@link LanguageServerRegistry}. + */ +@Singleton +@Path("languageserver/textDocument") +public class TextDocumentServiceImpl { + + LanguageServerRegistry languageServerRegistry; + + @Inject + public TextDocumentServiceImpl(LanguageServerRegistry languageServerRegistry) { + this.languageServerRegistry = languageServerRegistry; + } + + @POST + @Path("completion") + @Consumes(MediaType.APPLICATION_JSON) + @Produces(MediaType.APPLICATION_JSON) + public List completion(TextDocumentPositionParamsDTO textDocumentPositionParams) { + LanguageServer server = getServer(textDocumentPositionParams.getTextDocument().getUri()); + List completion = server.getTextDocumentService() + .completion(textDocumentPositionParams); + return completion; + } + + @POST + @Path("didChange") + @Consumes(MediaType.APPLICATION_JSON) + public void didChange(DidChangeTextDocumentParamsDTO change) { + LanguageServer server = getServer(change.getTextDocument().getUri()); + server.getTextDocumentService().didChange(change); + } + + @POST + @Path("didOpen") + @Consumes(MediaType.APPLICATION_JSON) + public void didOpen(DidOpenTextDocumentParamsDTO openEvent) { + LanguageServer server = getServer(openEvent.getTextDocument().getUri()); + server.getTextDocumentService().didOpen(openEvent); + } + + @POST + @Path("didClose") + @Consumes(MediaType.APPLICATION_JSON) + public void didClose(DidCloseTextDocumentParamsDTO closeEvent) { + LanguageServer server = getServer(closeEvent.getTextDocument().getUri()); + server.getTextDocumentService().didClose(closeEvent); + } + + @POST + @Path("didSave") + @Consumes(MediaType.APPLICATION_JSON) + public void didSave(DidSaveTextDocumentParamsDTO saveEvent) { + LanguageServer server = getServer(saveEvent.getTextDocument().getUri()); + server.getTextDocumentService().didSave(saveEvent); + } + + private LanguageServer getServer(String uri) { + LanguageServer server = languageServerRegistry.findServer(uri); + if (server == null) { + throw new IllegalStateException("Couldn't find registered language server for path '" + uri + "'."); + } + return server; + } +} diff --git a/plugins/plugin-languageserver/che-plugin-languageserver-server/src/main/java/org/eclipse/che/plugin/languageserver/server/dummyimpl/FooLanguageServer.java b/plugins/plugin-languageserver/che-plugin-languageserver-server/src/main/java/org/eclipse/che/plugin/languageserver/server/dummyimpl/FooLanguageServer.java new file mode 100644 index 00000000000..e678c331da2 --- /dev/null +++ b/plugins/plugin-languageserver/che-plugin-languageserver-server/src/main/java/org/eclipse/che/plugin/languageserver/server/dummyimpl/FooLanguageServer.java @@ -0,0 +1,66 @@ +package org.eclipse.che.plugin.languageserver.server.dummyimpl; + +import org.eclipse.che.plugin.languageserver.server.LanguageServerRegistry; + +import com.google.inject.Inject; +import com.google.inject.Singleton; + +import io.typefox.lsapi.InitializeParams; +import io.typefox.lsapi.InitializeResult; +import io.typefox.lsapi.LanguageServer; +import io.typefox.lsapi.TextDocumentService; +import io.typefox.lsapi.WindowService; +import io.typefox.lsapi.WorkspaceService; + +/** + * A dummy language server. + */ +@Singleton +public class FooLanguageServer implements LanguageServer { + + private String rootPath; + private FooTextDocumentService documentService; + + @Inject + public FooLanguageServer(LanguageServerRegistry registry) { + // This is of course a HACK! Language servers should be + // registered dynamically instead. I.e. by some sort of preferences + // where e.g. + // maven coordinates and an implementation class are provided. + + registry.registerForExtension("foo", this); + } + + @Override + public InitializeResult initialize(InitializeParams params) { + rootPath = params.getRootPath(); + this.documentService = new FooTextDocumentService(rootPath); + return null; + } + + @Override + public void shutdown() { + } + + @Override + public void exit() { + } + + @Override + public TextDocumentService getTextDocumentService() { + if (documentService == null) + throw new IllegalStateException("Langauge server has not been initialized."); + return documentService; + } + + @Override + public WorkspaceService getWorkspaceService() { + return null; + } + + @Override + public WindowService getWindowService() { + return null; + } + +} diff --git a/plugins/plugin-languageserver/che-plugin-languageserver-server/src/main/java/org/eclipse/che/plugin/languageserver/server/dummyimpl/FooTextDocumentService.java b/plugins/plugin-languageserver/che-plugin-languageserver-server/src/main/java/org/eclipse/che/plugin/languageserver/server/dummyimpl/FooTextDocumentService.java new file mode 100644 index 00000000000..407f14869dc --- /dev/null +++ b/plugins/plugin-languageserver/che-plugin-languageserver-server/src/main/java/org/eclipse/che/plugin/languageserver/server/dummyimpl/FooTextDocumentService.java @@ -0,0 +1,296 @@ +package org.eclipse.che.plugin.languageserver.server.dummyimpl; + +import static com.google.common.collect.Lists.newArrayList; +import static com.google.common.collect.Maps.newHashMap; + +import java.io.File; +import java.io.IOException; +import java.nio.charset.Charset; +import java.util.List; +import java.util.Map; + +import com.google.common.base.Splitter; +import com.google.common.io.Files; + +import io.typefox.lsapi.CodeActionParams; +import io.typefox.lsapi.CodeLens; +import io.typefox.lsapi.CodeLensParams; +import io.typefox.lsapi.Command; +import io.typefox.lsapi.CompletionItem; +import io.typefox.lsapi.CompletionItemImpl; +import io.typefox.lsapi.Diagnostic; +import io.typefox.lsapi.DiagnosticImpl; +import io.typefox.lsapi.DidChangeTextDocumentParams; +import io.typefox.lsapi.DidCloseTextDocumentParams; +import io.typefox.lsapi.DidOpenTextDocumentParams; +import io.typefox.lsapi.DidSaveTextDocumentParams; +import io.typefox.lsapi.DocumentFormattingParams; +import io.typefox.lsapi.DocumentHighlight; +import io.typefox.lsapi.DocumentOnTypeFormattingParams; +import io.typefox.lsapi.DocumentRangeFormattingParams; +import io.typefox.lsapi.DocumentSymbolParams; +import io.typefox.lsapi.Hover; +import io.typefox.lsapi.Location; +import io.typefox.lsapi.NotificationCallback; +import io.typefox.lsapi.Position; +import io.typefox.lsapi.PositionImpl; +import io.typefox.lsapi.PublishDiagnosticsParams; +import io.typefox.lsapi.PublishDiagnosticsParamsImpl; +import io.typefox.lsapi.RangeImpl; +import io.typefox.lsapi.ReferenceParams; +import io.typefox.lsapi.RenameParams; +import io.typefox.lsapi.SignatureHelp; +import io.typefox.lsapi.SymbolInformation; +import io.typefox.lsapi.TextDocumentContentChangeEvent; +import io.typefox.lsapi.TextDocumentPositionParams; +import io.typefox.lsapi.TextDocumentService; +import io.typefox.lsapi.TextEdit; +import io.typefox.lsapi.TextEditImpl; +import io.typefox.lsapi.WorkspaceEdit; + +public class FooTextDocumentService implements TextDocumentService { + + private String rootPath; + + public FooTextDocumentService(String rootPath) { + this.rootPath = rootPath; + } + + @Override + public List completion(TextDocumentPositionParams position) { + List result = newArrayList(); + result.add(newCompletionItem("foo", position.getPosition().getLine(), position.getPosition().getCharacter())); + result.add(newCompletionItem("bar", position.getPosition().getLine(), position.getPosition().getCharacter())); + return result; + } + + private CompletionItemImpl newCompletionItem(String newText, int line, int character) { + CompletionItemImpl item = new CompletionItemImpl(); + item.setLabel(newText+" - Inserts "+newText); + TextEditImpl textEdit = new TextEditImpl(); + textEdit.setNewText(newText); + textEdit.setRange(newRange(line, character, line, character)); + item.setTextEdit(textEdit); + return item; + } + + private RangeImpl newRange(int line, int character, int line2, int character2) { + RangeImpl result = new RangeImpl(); + PositionImpl start = new PositionImpl(); + start.setLine(line); + start.setCharacter(character); + result.setStart(start); + PositionImpl end = new PositionImpl(); + end.setLine(line2); + end.setCharacter(character2); + result.setEnd(end); + return result; + } + + private Map openDocuments = newHashMap(); + + private static class Document { + int version; + String contents; + + public Document(int version, String contents) { + this.version = version; + this.contents = contents; + } + + public void apply(TextDocumentContentChangeEvent change) { + int start = getOffSet(change.getRange().getStart()); + int end = getOffSet(change.getRange().getEnd()); + if (end < start) { + end = start; + } + if (start > -1) + this.contents = contents.substring(0, start)+change.getText()+contents.substring(end); + } + + public int getOffSet(Position pos) { + char[] charArray = contents.toCharArray(); + int line = 0; + int character = 0; + for (int i = 0; i < charArray.length; i++) { + char c = charArray[i]; + if (c == '\n') { + line++; + character = 0; + } else { + character++; + } + if (line == pos.getLine() && character == pos.getCharacter()) { + return i+1; + } + } + return -1; + } + } + + @Override + public void didChange(DidChangeTextDocumentParams params) { + String uri = params.getTextDocument().getUri(); + Document doc = openDocuments.get(uri); + if (doc == null || doc.version > params.getTextDocument().getVersion()) { + return; + } + if (doc.version + 1 < params.getTextDocument().getVersion()) { + // missed a change. + File file = new File(rootPath + uri); + String contents; + try { + contents = Files.toString(file, Charset.defaultCharset()); + openDocuments.put(uri, new Document(params.getTextDocument().getVersion(), contents)); + } catch (IOException e) { + e.printStackTrace(); + } + } else { + List changes = params.getContentChanges(); + for (TextDocumentContentChangeEvent change : changes) { + doc.apply(change); + } + doc.version = params.getTextDocument().getVersion(); + } + validateDocument(uri); + } + + @Override + public void didOpen(DidOpenTextDocumentParams params) { + String uri = params.getTextDocument().getUri(); + File file = new File(rootPath + uri); + String contents; + try { + contents = Files.toString(file, Charset.defaultCharset()); + openDocuments.put(uri, new Document(params.getTextDocument().getVersion(), contents)); + validateDocument(uri); + } catch (IOException e) { + e.printStackTrace(); + } + } + + @Override + public void didClose(DidCloseTextDocumentParams params) { + openDocuments.remove(params.getTextDocument().getUri()); + } + + @Override + public void didSave(DidSaveTextDocumentParams params) { + } + + private void validateDocument(String uri) { + Document document = openDocuments.get(uri); + List lines = Splitter.on('\n').splitToList(document.contents); + PublishDiagnosticsParamsImpl diagnosticsMessage = new PublishDiagnosticsParamsImpl(); + diagnosticsMessage.setUri(uri); + diagnosticsMessage.setDiagnostics(newArrayList()); + for (int currentLineIdx = 0; currentLineIdx < lines.size(); currentLineIdx++) { + String line = lines.get(currentLineIdx); + int indexOf = line.indexOf("Foo"); + final int lineIdx = currentLineIdx; + if (indexOf != -1) { + DiagnosticImpl diagnosticImpl = new DiagnosticImpl(); + diagnosticImpl.setCode("no.uppercase.foo"); + diagnosticImpl.setMessage("Please use lower case 'foo'."); + diagnosticImpl.setRange(newRange(lineIdx, indexOf, lineIdx, indexOf+3)); + diagnosticImpl.setSeverity(Diagnostic.SEVERITY_ERROR); + diagnosticsMessage.getDiagnostics().add(diagnosticImpl); + } + } + for (NotificationCallback callback : publishDiagnosticsCallbacks) { + callback.call(diagnosticsMessage); + } + } + + private final List> publishDiagnosticsCallbacks = newArrayList(); + + @Override + public void onPublishDiagnostics(NotificationCallback callback) { + publishDiagnosticsCallbacks.add(callback); + } + + @Override + public CompletionItem resolveCompletionItem(CompletionItem unresolved) { + // TODO Auto-generated method stub + return null; + } + + @Override + public Hover hover(TextDocumentPositionParams position) { + // TODO Auto-generated method stub + return null; + } + + @Override + public SignatureHelp signatureHelp(TextDocumentPositionParams position) { + // TODO Auto-generated method stub + return null; + } + + @Override + public List definition(TextDocumentPositionParams position) { + // TODO Auto-generated method stub + return null; + } + + @Override + public List references(ReferenceParams params) { + // TODO Auto-generated method stub + return null; + } + + @Override + public DocumentHighlight documentHighlight(TextDocumentPositionParams position) { + // TODO Auto-generated method stub + return null; + } + + @Override + public List documentSymbol(DocumentSymbolParams params) { + // TODO Auto-generated method stub + return null; + } + + @Override + public List codeAction(CodeActionParams params) { + // TODO Auto-generated method stub + return null; + } + + @Override + public List codeLens(CodeLensParams params) { + // TODO Auto-generated method stub + return null; + } + + @Override + public CodeLens resolveCodeLens(CodeLens unresolved) { + // TODO Auto-generated method stub + return null; + } + + @Override + public List formatting(DocumentFormattingParams params) { + // TODO Auto-generated method stub + return null; + } + + @Override + public List rangeFormatting(DocumentRangeFormattingParams params) { + // TODO Auto-generated method stub + return null; + } + + @Override + public List onTypeFormatting(DocumentOnTypeFormattingParams params) { + // TODO Auto-generated method stub + return null; + } + + @Override + public WorkspaceEdit rename(RenameParams params) { + // TODO Auto-generated method stub + return null; + } + +} diff --git a/plugins/plugin-languageserver/che-plugin-languageserver-server/src/main/java/org/eclipse/che/plugin/languageserver/server/lsapi/PublishDiagnosticsParamsMessenger.java b/plugins/plugin-languageserver/che-plugin-languageserver-server/src/main/java/org/eclipse/che/plugin/languageserver/server/lsapi/PublishDiagnosticsParamsMessenger.java new file mode 100644 index 00000000000..b02b44a7777 --- /dev/null +++ b/plugins/plugin-languageserver/che-plugin-languageserver-server/src/main/java/org/eclipse/che/plugin/languageserver/server/lsapi/PublishDiagnosticsParamsMessenger.java @@ -0,0 +1,55 @@ +package org.eclipse.che.plugin.languageserver.server.lsapi; + +import java.io.IOException; + +import javax.annotation.PostConstruct; +import javax.annotation.PreDestroy; +import javax.inject.Inject; +import javax.inject.Singleton; +import javax.websocket.EncodeException; + +import org.eclipse.che.api.core.notification.EventService; +import org.eclipse.che.api.core.notification.EventSubscriber; +import org.everrest.websockets.WSConnectionContext; +import org.everrest.websockets.message.ChannelBroadcastMessage; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.google.gson.Gson; + +import io.typefox.lsapi.PublishDiagnosticsParams; + +@Singleton +public class PublishDiagnosticsParamsMessenger implements EventSubscriber { + private final static Logger LOG = LoggerFactory.getLogger(PublishDiagnosticsParamsMessenger.class); + + private EventService eventService; + + @Inject + public PublishDiagnosticsParamsMessenger(final EventService eventService) { + this.eventService = eventService; + } + + public void onEvent(final PublishDiagnosticsParams event) { + try { + final ChannelBroadcastMessage bm = new ChannelBroadcastMessage(); + bm.setChannel("languageserver/textDocument/publishDiagnostics"); + bm.setBody(new Gson().toJson(event)); + WSConnectionContext.sendMessage(bm); + } catch (EncodeException e) { + LOG.error(e.getMessage(), e); + } catch (IOException e) { + LOG.error(e.getMessage(), e); + } + } + + @PostConstruct + public void subscribe() { + eventService.subscribe(this); + } + + @PreDestroy + public void unsubscribe() { + eventService.unsubscribe(this); + } +} diff --git a/plugins/plugin-languageserver/che-plugin-languageserver-shared/pom.xml b/plugins/plugin-languageserver/che-plugin-languageserver-shared/pom.xml new file mode 100644 index 00000000000..3f703665dee --- /dev/null +++ b/plugins/plugin-languageserver/che-plugin-languageserver-shared/pom.xml @@ -0,0 +1,158 @@ + + + + 4.0.0 + + che-plugin-languageserver-parent + org.eclipse.che.plugin + 4.3.0-RC1-SNAPSHOT + + che-plugin-languageserver-shared + Che Plugin :: Language Server :: Shared + + ${project.build.directory}/generated-sources/dto/ + false + + + + com.google.code.gson + gson + + + com.google.inject + guice + + + io.typefox.lsapi + io.typefox.lsapi + + + org.eclipse.che.core + che-core-api-dto + + + org.eclipse.che.core + che-core-commons-gwt + + + com.google.gwt + gwt-user + provided + + + + + + src/main/java + + + src/main/resources + + + ${dto-generator-out-directory} + + + + + org.codehaus.mojo + build-helper-maven-plugin + + + add-resource + process-sources + + add-resource + + + + + ${dto-generator-out-directory}/META-INF + META-INF + + + + + + add-source + process-sources + + add-source + + + + ${dto-generator-out-directory} + + + + + + + maven-compiler-plugin + + + pre-compile + generate-sources + + compile + + + + + + org.eclipse.che.core + che-core-api-dto-maven-plugin + ${project.version} + + + generate-client-dto + process-sources + + generate + + + + org.eclipse.che.plugin.languageserver.shared + + ${dto-generator-out-directory} + org.eclipse.che.plugin.languageserver.shared.dto.DtoClientImpls + client + + + + generate-server-dto + process-sources + + generate + + + + org.eclipse.che.plugin.languageserver.shared + + ${dto-generator-out-directory} + org.eclipse.che.plugin.languageserver.shared.dto.DtoServerImpls + server + + + + + + ${project.groupId} + ${project.artifactId} + ${project.version} + + + + + + diff --git a/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/FileTypeDTO.java b/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/FileTypeDTO.java new file mode 100644 index 00000000000..5e5172e7ec1 --- /dev/null +++ b/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/FileTypeDTO.java @@ -0,0 +1,18 @@ +package org.eclipse.che.plugin.languageserver.shared; + +import java.util.List; + +import org.eclipse.che.dto.shared.DTO; + +@DTO +public interface FileTypeDTO { + String getId(); + + List getMimeTypes(); + + String getExtension(); + + String getNamePattern(); + + String getContentDescription(); +} diff --git a/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/CancelParamsDTO.java b/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/CancelParamsDTO.java new file mode 100644 index 00000000000..597bab9133c --- /dev/null +++ b/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/CancelParamsDTO.java @@ -0,0 +1,17 @@ +/** + * Copyright (c) 2016 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.che.plugin.languageserver.shared.lsapi; + +import org.eclipse.che.dto.shared.DTO; + +import io.typefox.lsapi.CancelParams; + +@DTO +@SuppressWarnings("all") +public interface CancelParamsDTO extends CancelParams { +} diff --git a/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/CodeActionContextDTO.java b/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/CodeActionContextDTO.java new file mode 100644 index 00000000000..e0b849562d3 --- /dev/null +++ b/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/CodeActionContextDTO.java @@ -0,0 +1,24 @@ +/** + * Copyright (c) 2016 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.che.plugin.languageserver.shared.lsapi; + +import java.util.List; + +import org.eclipse.che.dto.shared.DTO; + +import io.typefox.lsapi.CodeActionContext; + +@DTO +@SuppressWarnings("all") +public interface CodeActionContextDTO extends CodeActionContext { + /** + * Overridden to return the DTO type. + * + */ + public abstract List getDiagnostics(); +} diff --git a/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/CodeActionParamsDTO.java b/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/CodeActionParamsDTO.java new file mode 100644 index 00000000000..82672607a9a --- /dev/null +++ b/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/CodeActionParamsDTO.java @@ -0,0 +1,34 @@ +/** + * Copyright (c) 2016 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.che.plugin.languageserver.shared.lsapi; + +import org.eclipse.che.dto.shared.DTO; + +import io.typefox.lsapi.CodeActionParams; + +@DTO +@SuppressWarnings("all") +public interface CodeActionParamsDTO extends CodeActionParams { + /** + * Overridden to return the DTO type. + * + */ + public abstract TextDocumentIdentifierDTO getTextDocument(); + + /** + * Overridden to return the DTO type. + * + */ + public abstract RangeDTO getRange(); + + /** + * Overridden to return the DTO type. + * + */ + public abstract CodeActionContextDTO getContext(); +} diff --git a/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/CodeLensDTO.java b/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/CodeLensDTO.java new file mode 100644 index 00000000000..b934514e2d2 --- /dev/null +++ b/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/CodeLensDTO.java @@ -0,0 +1,28 @@ +/** + * Copyright (c) 2016 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.che.plugin.languageserver.shared.lsapi; + +import org.eclipse.che.dto.shared.DTO; + +import io.typefox.lsapi.CodeLens; + +@DTO +@SuppressWarnings("all") +public interface CodeLensDTO extends CodeLens { + /** + * Overridden to return the DTO type. + * + */ + public abstract RangeDTO getRange(); + + /** + * Overridden to return the DTO type. + * + */ + public abstract CommandDTO getCommand(); +} diff --git a/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/CodeLensOptionsDTO.java b/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/CodeLensOptionsDTO.java new file mode 100644 index 00000000000..9029a52b23a --- /dev/null +++ b/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/CodeLensOptionsDTO.java @@ -0,0 +1,17 @@ +/** + * Copyright (c) 2016 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.che.plugin.languageserver.shared.lsapi; + +import org.eclipse.che.dto.shared.DTO; + +import io.typefox.lsapi.CodeLensOptions; + +@DTO +@SuppressWarnings("all") +public interface CodeLensOptionsDTO extends CodeLensOptions { +} diff --git a/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/CodeLensParamsDTO.java b/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/CodeLensParamsDTO.java new file mode 100644 index 00000000000..9ac4a492e2e --- /dev/null +++ b/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/CodeLensParamsDTO.java @@ -0,0 +1,22 @@ +/** + * Copyright (c) 2016 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.che.plugin.languageserver.shared.lsapi; + +import org.eclipse.che.dto.shared.DTO; + +import io.typefox.lsapi.CodeLensParams; + +@DTO +@SuppressWarnings("all") +public interface CodeLensParamsDTO extends CodeLensParams { + /** + * Overridden to return the DTO type. + * + */ + public abstract TextDocumentIdentifierDTO getTextDocument(); +} diff --git a/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/CommandDTO.java b/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/CommandDTO.java new file mode 100644 index 00000000000..fdef8e6d530 --- /dev/null +++ b/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/CommandDTO.java @@ -0,0 +1,17 @@ +/** + * Copyright (c) 2016 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.che.plugin.languageserver.shared.lsapi; + +import org.eclipse.che.dto.shared.DTO; + +import io.typefox.lsapi.Command; + +@DTO +@SuppressWarnings("all") +public interface CommandDTO extends Command { +} diff --git a/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/CompletionItemDTO.java b/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/CompletionItemDTO.java new file mode 100644 index 00000000000..399e80c1a2b --- /dev/null +++ b/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/CompletionItemDTO.java @@ -0,0 +1,22 @@ +/** + * Copyright (c) 2016 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.che.plugin.languageserver.shared.lsapi; + +import org.eclipse.che.dto.shared.DTO; + +import io.typefox.lsapi.CompletionItem; + +@DTO +@SuppressWarnings("all") +public interface CompletionItemDTO extends CompletionItem { + /** + * Overridden to return the DTO type. + * + */ + public abstract TextEditDTO getTextEdit(); +} diff --git a/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/CompletionOptionsDTO.java b/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/CompletionOptionsDTO.java new file mode 100644 index 00000000000..d13c1d3b232 --- /dev/null +++ b/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/CompletionOptionsDTO.java @@ -0,0 +1,17 @@ +/** + * Copyright (c) 2016 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.che.plugin.languageserver.shared.lsapi; + +import org.eclipse.che.dto.shared.DTO; + +import io.typefox.lsapi.CompletionOptions; + +@DTO +@SuppressWarnings("all") +public interface CompletionOptionsDTO extends CompletionOptions { +} diff --git a/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/DiagnosticDTO.java b/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/DiagnosticDTO.java new file mode 100644 index 00000000000..0f9d46ba02b --- /dev/null +++ b/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/DiagnosticDTO.java @@ -0,0 +1,22 @@ +/** + * Copyright (c) 2016 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.che.plugin.languageserver.shared.lsapi; + +import org.eclipse.che.dto.shared.DTO; + +import io.typefox.lsapi.Diagnostic; + +@DTO +@SuppressWarnings("all") +public interface DiagnosticDTO extends Diagnostic { + /** + * Overridden to return the DTO type. + * + */ + public abstract RangeDTO getRange(); +} diff --git a/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/DidChangeConfigurationParamsDTO.java b/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/DidChangeConfigurationParamsDTO.java new file mode 100644 index 00000000000..434c50f5d5d --- /dev/null +++ b/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/DidChangeConfigurationParamsDTO.java @@ -0,0 +1,17 @@ +/** + * Copyright (c) 2016 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.che.plugin.languageserver.shared.lsapi; + +import org.eclipse.che.dto.shared.DTO; + +import io.typefox.lsapi.DidChangeConfigurationParams; + +@DTO +@SuppressWarnings("all") +public interface DidChangeConfigurationParamsDTO extends DidChangeConfigurationParams { +} diff --git a/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/DidChangeTextDocumentParamsDTO.java b/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/DidChangeTextDocumentParamsDTO.java new file mode 100644 index 00000000000..7b6864d9a1d --- /dev/null +++ b/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/DidChangeTextDocumentParamsDTO.java @@ -0,0 +1,30 @@ +/** + * Copyright (c) 2016 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.che.plugin.languageserver.shared.lsapi; + +import java.util.List; + +import org.eclipse.che.dto.shared.DTO; + +import io.typefox.lsapi.DidChangeTextDocumentParams; + +@DTO +@SuppressWarnings("all") +public interface DidChangeTextDocumentParamsDTO extends DidChangeTextDocumentParams { + /** + * Overridden to return the DTO type. + * + */ + public abstract VersionedTextDocumentIdentifierDTO getTextDocument(); + + /** + * Overridden to return the DTO type. + * + */ + public abstract List getContentChanges(); +} diff --git a/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/DidChangeWatchedFilesParamsDTO.java b/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/DidChangeWatchedFilesParamsDTO.java new file mode 100644 index 00000000000..00583028975 --- /dev/null +++ b/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/DidChangeWatchedFilesParamsDTO.java @@ -0,0 +1,24 @@ +/** + * Copyright (c) 2016 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.che.plugin.languageserver.shared.lsapi; + +import java.util.List; + +import org.eclipse.che.dto.shared.DTO; + +import io.typefox.lsapi.DidChangeWatchedFilesParams; + +@DTO +@SuppressWarnings("all") +public interface DidChangeWatchedFilesParamsDTO extends DidChangeWatchedFilesParams { + /** + * Overridden to return the DTO type. + * + */ + public abstract List getChanges(); +} diff --git a/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/DidCloseTextDocumentParamsDTO.java b/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/DidCloseTextDocumentParamsDTO.java new file mode 100644 index 00000000000..5ed26bf576d --- /dev/null +++ b/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/DidCloseTextDocumentParamsDTO.java @@ -0,0 +1,22 @@ +/** + * Copyright (c) 2016 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.che.plugin.languageserver.shared.lsapi; + +import org.eclipse.che.dto.shared.DTO; + +import io.typefox.lsapi.DidCloseTextDocumentParams; + +@DTO +@SuppressWarnings("all") +public interface DidCloseTextDocumentParamsDTO extends DidCloseTextDocumentParams { + /** + * Overridden to return the DTO type. + * + */ + public abstract TextDocumentIdentifierDTO getTextDocument(); +} diff --git a/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/DidOpenTextDocumentParamsDTO.java b/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/DidOpenTextDocumentParamsDTO.java new file mode 100644 index 00000000000..5eebaaad771 --- /dev/null +++ b/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/DidOpenTextDocumentParamsDTO.java @@ -0,0 +1,22 @@ +/** + * Copyright (c) 2016 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.che.plugin.languageserver.shared.lsapi; + +import org.eclipse.che.dto.shared.DTO; + +import io.typefox.lsapi.DidOpenTextDocumentParams; + +@DTO +@SuppressWarnings("all") +public interface DidOpenTextDocumentParamsDTO extends DidOpenTextDocumentParams { + /** + * Overridden to return the DTO type. + * + */ + public abstract TextDocumentItemDTO getTextDocument(); +} diff --git a/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/DidSaveTextDocumentParamsDTO.java b/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/DidSaveTextDocumentParamsDTO.java new file mode 100644 index 00000000000..c480f6181e4 --- /dev/null +++ b/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/DidSaveTextDocumentParamsDTO.java @@ -0,0 +1,22 @@ +/** + * Copyright (c) 2016 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.che.plugin.languageserver.shared.lsapi; + +import org.eclipse.che.dto.shared.DTO; + +import io.typefox.lsapi.DidSaveTextDocumentParams; + +@DTO +@SuppressWarnings("all") +public interface DidSaveTextDocumentParamsDTO extends DidSaveTextDocumentParams { + /** + * Overridden to return the DTO type. + * + */ + public abstract TextDocumentIdentifierDTO getTextDocument(); +} diff --git a/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/DocumentFormattingParamsDTO.java b/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/DocumentFormattingParamsDTO.java new file mode 100644 index 00000000000..7f9692aacad --- /dev/null +++ b/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/DocumentFormattingParamsDTO.java @@ -0,0 +1,28 @@ +/** + * Copyright (c) 2016 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.che.plugin.languageserver.shared.lsapi; + +import org.eclipse.che.dto.shared.DTO; + +import io.typefox.lsapi.DocumentFormattingParams; + +@DTO +@SuppressWarnings("all") +public interface DocumentFormattingParamsDTO extends DocumentFormattingParams { + /** + * Overridden to return the DTO type. + * + */ + public abstract TextDocumentIdentifierDTO getTextDocument(); + + /** + * Overridden to return the DTO type. + * + */ + public abstract FormattingOptionsDTO getOptions(); +} diff --git a/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/DocumentHighlightDTO.java b/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/DocumentHighlightDTO.java new file mode 100644 index 00000000000..5ea8ada95aa --- /dev/null +++ b/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/DocumentHighlightDTO.java @@ -0,0 +1,22 @@ +/** + * Copyright (c) 2016 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.che.plugin.languageserver.shared.lsapi; + +import org.eclipse.che.dto.shared.DTO; + +import io.typefox.lsapi.DocumentHighlight; + +@DTO +@SuppressWarnings("all") +public interface DocumentHighlightDTO extends DocumentHighlight { + /** + * Overridden to return the DTO type. + * + */ + public abstract RangeDTO getRange(); +} diff --git a/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/DocumentOnTypeFormattingOptionsDTO.java b/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/DocumentOnTypeFormattingOptionsDTO.java new file mode 100644 index 00000000000..4201c5a4357 --- /dev/null +++ b/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/DocumentOnTypeFormattingOptionsDTO.java @@ -0,0 +1,17 @@ +/** + * Copyright (c) 2016 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.che.plugin.languageserver.shared.lsapi; + +import org.eclipse.che.dto.shared.DTO; + +import io.typefox.lsapi.DocumentOnTypeFormattingOptions; + +@DTO +@SuppressWarnings("all") +public interface DocumentOnTypeFormattingOptionsDTO extends DocumentOnTypeFormattingOptions { +} diff --git a/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/DocumentOnTypeFormattingParamsDTO.java b/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/DocumentOnTypeFormattingParamsDTO.java new file mode 100644 index 00000000000..0e50f660861 --- /dev/null +++ b/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/DocumentOnTypeFormattingParamsDTO.java @@ -0,0 +1,34 @@ +/** + * Copyright (c) 2016 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.che.plugin.languageserver.shared.lsapi; + +import org.eclipse.che.dto.shared.DTO; + +import io.typefox.lsapi.DocumentOnTypeFormattingParams; + +@DTO +@SuppressWarnings("all") +public interface DocumentOnTypeFormattingParamsDTO extends DocumentOnTypeFormattingParams { + /** + * Overridden to return the DTO type. + * + */ + public abstract PositionDTO getPosition(); + + /** + * Overridden to return the DTO type. + * + */ + public abstract TextDocumentIdentifierDTO getTextDocument(); + + /** + * Overridden to return the DTO type. + * + */ + public abstract FormattingOptionsDTO getOptions(); +} diff --git a/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/DocumentRangeFormattingParamsDTO.java b/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/DocumentRangeFormattingParamsDTO.java new file mode 100644 index 00000000000..8a5cc544216 --- /dev/null +++ b/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/DocumentRangeFormattingParamsDTO.java @@ -0,0 +1,34 @@ +/** + * Copyright (c) 2016 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.che.plugin.languageserver.shared.lsapi; + +import org.eclipse.che.dto.shared.DTO; + +import io.typefox.lsapi.DocumentRangeFormattingParams; + +@DTO +@SuppressWarnings("all") +public interface DocumentRangeFormattingParamsDTO extends DocumentRangeFormattingParams { + /** + * Overridden to return the DTO type. + * + */ + public abstract RangeDTO getRange(); + + /** + * Overridden to return the DTO type. + * + */ + public abstract TextDocumentIdentifierDTO getTextDocument(); + + /** + * Overridden to return the DTO type. + * + */ + public abstract FormattingOptionsDTO getOptions(); +} diff --git a/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/DocumentSymbolParamsDTO.java b/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/DocumentSymbolParamsDTO.java new file mode 100644 index 00000000000..aac1c1feb0a --- /dev/null +++ b/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/DocumentSymbolParamsDTO.java @@ -0,0 +1,22 @@ +/** + * Copyright (c) 2016 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.che.plugin.languageserver.shared.lsapi; + +import org.eclipse.che.dto.shared.DTO; + +import io.typefox.lsapi.DocumentSymbolParams; + +@DTO +@SuppressWarnings("all") +public interface DocumentSymbolParamsDTO extends DocumentSymbolParams { + /** + * Overridden to return the DTO type. + * + */ + public abstract TextDocumentIdentifierDTO getTextDocument(); +} diff --git a/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/FileEventDTO.java b/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/FileEventDTO.java new file mode 100644 index 00000000000..606fe8592c0 --- /dev/null +++ b/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/FileEventDTO.java @@ -0,0 +1,17 @@ +/** + * Copyright (c) 2016 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.che.plugin.languageserver.shared.lsapi; + +import org.eclipse.che.dto.shared.DTO; + +import io.typefox.lsapi.FileEvent; + +@DTO +@SuppressWarnings("all") +public interface FileEventDTO extends FileEvent { +} diff --git a/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/FormattingOptionsDTO.java b/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/FormattingOptionsDTO.java new file mode 100644 index 00000000000..5c556f294c6 --- /dev/null +++ b/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/FormattingOptionsDTO.java @@ -0,0 +1,17 @@ +/** + * Copyright (c) 2016 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.che.plugin.languageserver.shared.lsapi; + +import org.eclipse.che.dto.shared.DTO; + +import io.typefox.lsapi.FormattingOptions; + +@DTO +@SuppressWarnings("all") +public interface FormattingOptionsDTO extends FormattingOptions { +} diff --git a/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/HoverDTO.java b/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/HoverDTO.java new file mode 100644 index 00000000000..a93738cde8d --- /dev/null +++ b/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/HoverDTO.java @@ -0,0 +1,30 @@ +/** + * Copyright (c) 2016 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.che.plugin.languageserver.shared.lsapi; + +import java.util.List; + +import org.eclipse.che.dto.shared.DTO; + +import io.typefox.lsapi.Hover; + +@DTO +@SuppressWarnings("all") +public interface HoverDTO extends Hover { + /** + * Overridden to return the DTO type. + * + */ + public abstract List getContents(); + + /** + * Overridden to return the DTO type. + * + */ + public abstract RangeDTO getRange(); +} diff --git a/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/InitializeErrorDTO.java b/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/InitializeErrorDTO.java new file mode 100644 index 00000000000..f63232da977 --- /dev/null +++ b/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/InitializeErrorDTO.java @@ -0,0 +1,17 @@ +/** + * Copyright (c) 2016 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.che.plugin.languageserver.shared.lsapi; + +import org.eclipse.che.dto.shared.DTO; + +import io.typefox.lsapi.InitializeError; + +@DTO +@SuppressWarnings("all") +public interface InitializeErrorDTO extends InitializeError { +} diff --git a/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/InitializeParamsDTO.java b/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/InitializeParamsDTO.java new file mode 100644 index 00000000000..34d708a1886 --- /dev/null +++ b/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/InitializeParamsDTO.java @@ -0,0 +1,17 @@ +/** + * Copyright (c) 2016 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.che.plugin.languageserver.shared.lsapi; + +import org.eclipse.che.dto.shared.DTO; + +import io.typefox.lsapi.InitializeParams; + +@DTO +@SuppressWarnings("all") +public interface InitializeParamsDTO extends InitializeParams { +} diff --git a/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/InitializeResultDTO.java b/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/InitializeResultDTO.java new file mode 100644 index 00000000000..1329cee151d --- /dev/null +++ b/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/InitializeResultDTO.java @@ -0,0 +1,22 @@ +/** + * Copyright (c) 2016 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.che.plugin.languageserver.shared.lsapi; + +import org.eclipse.che.dto.shared.DTO; + +import io.typefox.lsapi.InitializeResult; + +@DTO +@SuppressWarnings("all") +public interface InitializeResultDTO extends InitializeResult { + /** + * Overridden to return the DTO type. + * + */ + public abstract ServerCapabilitiesDTO getCapabilities(); +} diff --git a/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/LocationDTO.java b/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/LocationDTO.java new file mode 100644 index 00000000000..37882de51a1 --- /dev/null +++ b/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/LocationDTO.java @@ -0,0 +1,22 @@ +/** + * Copyright (c) 2016 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.che.plugin.languageserver.shared.lsapi; + +import org.eclipse.che.dto.shared.DTO; + +import io.typefox.lsapi.Location; + +@DTO +@SuppressWarnings("all") +public interface LocationDTO extends Location { + /** + * Overridden to return the DTO type. + * + */ + public abstract RangeDTO getRange(); +} diff --git a/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/MarkedStringDTO.java b/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/MarkedStringDTO.java new file mode 100644 index 00000000000..c24c2888cb7 --- /dev/null +++ b/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/MarkedStringDTO.java @@ -0,0 +1,17 @@ +/** + * Copyright (c) 2016 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.che.plugin.languageserver.shared.lsapi; + +import org.eclipse.che.dto.shared.DTO; + +import io.typefox.lsapi.MarkedString; + +@DTO +@SuppressWarnings("all") +public interface MarkedStringDTO extends MarkedString { +} diff --git a/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/MessageActionItemDTO.java b/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/MessageActionItemDTO.java new file mode 100644 index 00000000000..414e0f799d4 --- /dev/null +++ b/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/MessageActionItemDTO.java @@ -0,0 +1,17 @@ +/** + * Copyright (c) 2016 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.che.plugin.languageserver.shared.lsapi; + +import org.eclipse.che.dto.shared.DTO; + +import io.typefox.lsapi.MessageActionItem; + +@DTO +@SuppressWarnings("all") +public interface MessageActionItemDTO extends MessageActionItem { +} diff --git a/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/MessageDTO.java b/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/MessageDTO.java new file mode 100644 index 00000000000..2cbc5d8f173 --- /dev/null +++ b/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/MessageDTO.java @@ -0,0 +1,17 @@ +/** + * Copyright (c) 2016 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.che.plugin.languageserver.shared.lsapi; + +import org.eclipse.che.dto.shared.DTO; + +import io.typefox.lsapi.Message; + +@DTO +@SuppressWarnings("all") +public interface MessageDTO extends Message { +} diff --git a/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/MessageParamsDTO.java b/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/MessageParamsDTO.java new file mode 100644 index 00000000000..93ac73f60d7 --- /dev/null +++ b/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/MessageParamsDTO.java @@ -0,0 +1,17 @@ +/** + * Copyright (c) 2016 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.che.plugin.languageserver.shared.lsapi; + +import org.eclipse.che.dto.shared.DTO; + +import io.typefox.lsapi.MessageParams; + +@DTO +@SuppressWarnings("all") +public interface MessageParamsDTO extends MessageParams { +} diff --git a/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/NotificationMessageDTO.java b/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/NotificationMessageDTO.java new file mode 100644 index 00000000000..f0424468d4b --- /dev/null +++ b/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/NotificationMessageDTO.java @@ -0,0 +1,17 @@ +/** + * Copyright (c) 2016 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.che.plugin.languageserver.shared.lsapi; + +import org.eclipse.che.dto.shared.DTO; + +import io.typefox.lsapi.NotificationMessage; + +@DTO +@SuppressWarnings("all") +public interface NotificationMessageDTO extends NotificationMessage { +} diff --git a/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/ParameterInformationDTO.java b/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/ParameterInformationDTO.java new file mode 100644 index 00000000000..8d1e0713d37 --- /dev/null +++ b/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/ParameterInformationDTO.java @@ -0,0 +1,17 @@ +/** + * Copyright (c) 2016 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.che.plugin.languageserver.shared.lsapi; + +import org.eclipse.che.dto.shared.DTO; + +import io.typefox.lsapi.ParameterInformation; + +@DTO +@SuppressWarnings("all") +public interface ParameterInformationDTO extends ParameterInformation { +} diff --git a/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/PositionDTO.java b/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/PositionDTO.java new file mode 100644 index 00000000000..de2506e1f1f --- /dev/null +++ b/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/PositionDTO.java @@ -0,0 +1,17 @@ +/** + * Copyright (c) 2016 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.che.plugin.languageserver.shared.lsapi; + +import org.eclipse.che.dto.shared.DTO; + +import io.typefox.lsapi.Position; + +@DTO +@SuppressWarnings("all") +public interface PositionDTO extends Position { +} diff --git a/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/PublishDiagnosticsParamsDTO.java b/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/PublishDiagnosticsParamsDTO.java new file mode 100644 index 00000000000..81d4b75983f --- /dev/null +++ b/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/PublishDiagnosticsParamsDTO.java @@ -0,0 +1,24 @@ +/** + * Copyright (c) 2016 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.che.plugin.languageserver.shared.lsapi; + +import java.util.List; + +import org.eclipse.che.dto.shared.DTO; + +import io.typefox.lsapi.PublishDiagnosticsParams; + +@DTO +@SuppressWarnings("all") +public interface PublishDiagnosticsParamsDTO extends PublishDiagnosticsParams { + /** + * Overridden to return the DTO type. + * + */ + public abstract List getDiagnostics(); +} diff --git a/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/RangeDTO.java b/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/RangeDTO.java new file mode 100644 index 00000000000..a107c3e903d --- /dev/null +++ b/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/RangeDTO.java @@ -0,0 +1,28 @@ +/** + * Copyright (c) 2016 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.che.plugin.languageserver.shared.lsapi; + +import org.eclipse.che.dto.shared.DTO; + +import io.typefox.lsapi.Range; + +@DTO +@SuppressWarnings("all") +public interface RangeDTO extends Range { + /** + * Overridden to return the DTO type. + * + */ + public abstract PositionDTO getStart(); + + /** + * Overridden to return the DTO type. + * + */ + public abstract PositionDTO getEnd(); +} diff --git a/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/ReferenceContextDTO.java b/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/ReferenceContextDTO.java new file mode 100644 index 00000000000..011cbd1699d --- /dev/null +++ b/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/ReferenceContextDTO.java @@ -0,0 +1,17 @@ +/** + * Copyright (c) 2016 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.che.plugin.languageserver.shared.lsapi; + +import org.eclipse.che.dto.shared.DTO; + +import io.typefox.lsapi.ReferenceContext; + +@DTO +@SuppressWarnings("all") +public interface ReferenceContextDTO extends ReferenceContext { +} diff --git a/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/ReferenceParamsDTO.java b/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/ReferenceParamsDTO.java new file mode 100644 index 00000000000..33d7ebebbef --- /dev/null +++ b/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/ReferenceParamsDTO.java @@ -0,0 +1,34 @@ +/** + * Copyright (c) 2016 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.che.plugin.languageserver.shared.lsapi; + +import org.eclipse.che.dto.shared.DTO; + +import io.typefox.lsapi.ReferenceParams; + +@DTO +@SuppressWarnings("all") +public interface ReferenceParamsDTO extends ReferenceParams { + /** + * Overridden to return the DTO type. + * + */ + public abstract ReferenceContextDTO getContext(); + + /** + * Overridden to return the DTO type. + * + */ + public abstract TextDocumentIdentifierDTO getTextDocument(); + + /** + * Overridden to return the DTO type. + * + */ + public abstract PositionDTO getPosition(); +} diff --git a/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/RenameParamsDTO.java b/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/RenameParamsDTO.java new file mode 100644 index 00000000000..eedea368879 --- /dev/null +++ b/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/RenameParamsDTO.java @@ -0,0 +1,28 @@ +/** + * Copyright (c) 2016 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.che.plugin.languageserver.shared.lsapi; + +import org.eclipse.che.dto.shared.DTO; + +import io.typefox.lsapi.RenameParams; + +@DTO +@SuppressWarnings("all") +public interface RenameParamsDTO extends RenameParams { + /** + * Overridden to return the DTO type. + * + */ + public abstract TextDocumentIdentifierDTO getTextDocument(); + + /** + * Overridden to return the DTO type. + * + */ + public abstract PositionDTO getPosition(); +} diff --git a/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/RequestMessageDTO.java b/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/RequestMessageDTO.java new file mode 100644 index 00000000000..539c1219114 --- /dev/null +++ b/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/RequestMessageDTO.java @@ -0,0 +1,17 @@ +/** + * Copyright (c) 2016 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.che.plugin.languageserver.shared.lsapi; + +import org.eclipse.che.dto.shared.DTO; + +import io.typefox.lsapi.RequestMessage; + +@DTO +@SuppressWarnings("all") +public interface RequestMessageDTO extends RequestMessage { +} diff --git a/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/ResponseErrorDTO.java b/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/ResponseErrorDTO.java new file mode 100644 index 00000000000..fcf2c06b168 --- /dev/null +++ b/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/ResponseErrorDTO.java @@ -0,0 +1,17 @@ +/** + * Copyright (c) 2016 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.che.plugin.languageserver.shared.lsapi; + +import org.eclipse.che.dto.shared.DTO; + +import io.typefox.lsapi.ResponseError; + +@DTO +@SuppressWarnings("all") +public interface ResponseErrorDTO extends ResponseError { +} diff --git a/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/ResponseMessageDTO.java b/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/ResponseMessageDTO.java new file mode 100644 index 00000000000..e9725440c0a --- /dev/null +++ b/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/ResponseMessageDTO.java @@ -0,0 +1,22 @@ +/** + * Copyright (c) 2016 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.che.plugin.languageserver.shared.lsapi; + +import org.eclipse.che.dto.shared.DTO; + +import io.typefox.lsapi.ResponseMessage; + +@DTO +@SuppressWarnings("all") +public interface ResponseMessageDTO extends ResponseMessage { + /** + * Overridden to return the DTO type. + * + */ + public abstract ResponseErrorDTO getError(); +} diff --git a/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/ServerCapabilitiesDTO.java b/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/ServerCapabilitiesDTO.java new file mode 100644 index 00000000000..2220f8d222e --- /dev/null +++ b/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/ServerCapabilitiesDTO.java @@ -0,0 +1,40 @@ +/** + * Copyright (c) 2016 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.che.plugin.languageserver.shared.lsapi; + +import org.eclipse.che.dto.shared.DTO; + +import io.typefox.lsapi.ServerCapabilities; + +@DTO +@SuppressWarnings("all") +public interface ServerCapabilitiesDTO extends ServerCapabilities { + /** + * Overridden to return the DTO type. + * + */ + public abstract CompletionOptionsDTO getCompletionProvider(); + + /** + * Overridden to return the DTO type. + * + */ + public abstract SignatureHelpOptionsDTO getSignatureHelpProvider(); + + /** + * Overridden to return the DTO type. + * + */ + public abstract CodeLensOptionsDTO getCodeLensProvider(); + + /** + * Overridden to return the DTO type. + * + */ + public abstract DocumentOnTypeFormattingOptionsDTO getDocumentOnTypeFormattingProvider(); +} diff --git a/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/ShowMessageRequestParamsDTO.java b/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/ShowMessageRequestParamsDTO.java new file mode 100644 index 00000000000..702fe6c7f9c --- /dev/null +++ b/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/ShowMessageRequestParamsDTO.java @@ -0,0 +1,24 @@ +/** + * Copyright (c) 2016 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.che.plugin.languageserver.shared.lsapi; + +import java.util.List; + +import org.eclipse.che.dto.shared.DTO; + +import io.typefox.lsapi.ShowMessageRequestParams; + +@DTO +@SuppressWarnings("all") +public interface ShowMessageRequestParamsDTO extends ShowMessageRequestParams { + /** + * Overridden to return the DTO type. + * + */ + public abstract List getActions(); +} diff --git a/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/SignatureHelpDTO.java b/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/SignatureHelpDTO.java new file mode 100644 index 00000000000..ba3f18bb0e0 --- /dev/null +++ b/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/SignatureHelpDTO.java @@ -0,0 +1,24 @@ +/** + * Copyright (c) 2016 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.che.plugin.languageserver.shared.lsapi; + +import java.util.List; + +import org.eclipse.che.dto.shared.DTO; + +import io.typefox.lsapi.SignatureHelp; + +@DTO +@SuppressWarnings("all") +public interface SignatureHelpDTO extends SignatureHelp { + /** + * Overridden to return the DTO type. + * + */ + public abstract List getSignatures(); +} diff --git a/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/SignatureHelpOptionsDTO.java b/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/SignatureHelpOptionsDTO.java new file mode 100644 index 00000000000..894ba54920a --- /dev/null +++ b/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/SignatureHelpOptionsDTO.java @@ -0,0 +1,17 @@ +/** + * Copyright (c) 2016 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.che.plugin.languageserver.shared.lsapi; + +import org.eclipse.che.dto.shared.DTO; + +import io.typefox.lsapi.SignatureHelpOptions; + +@DTO +@SuppressWarnings("all") +public interface SignatureHelpOptionsDTO extends SignatureHelpOptions { +} diff --git a/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/SignatureInformationDTO.java b/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/SignatureInformationDTO.java new file mode 100644 index 00000000000..d5bb216db34 --- /dev/null +++ b/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/SignatureInformationDTO.java @@ -0,0 +1,24 @@ +/** + * Copyright (c) 2016 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.che.plugin.languageserver.shared.lsapi; + +import java.util.List; + +import org.eclipse.che.dto.shared.DTO; + +import io.typefox.lsapi.SignatureInformation; + +@DTO +@SuppressWarnings("all") +public interface SignatureInformationDTO extends SignatureInformation { + /** + * Overridden to return the DTO type. + * + */ + public abstract List getParameters(); +} diff --git a/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/SymbolInformationDTO.java b/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/SymbolInformationDTO.java new file mode 100644 index 00000000000..5e6f7d918d9 --- /dev/null +++ b/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/SymbolInformationDTO.java @@ -0,0 +1,22 @@ +/** + * Copyright (c) 2016 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.che.plugin.languageserver.shared.lsapi; + +import org.eclipse.che.dto.shared.DTO; + +import io.typefox.lsapi.SymbolInformation; + +@DTO +@SuppressWarnings("all") +public interface SymbolInformationDTO extends SymbolInformation { + /** + * Overridden to return the DTO type. + * + */ + public abstract LocationDTO getLocation(); +} diff --git a/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/TextDocumentContentChangeEventDTO.java b/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/TextDocumentContentChangeEventDTO.java new file mode 100644 index 00000000000..f81f944fb8d --- /dev/null +++ b/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/TextDocumentContentChangeEventDTO.java @@ -0,0 +1,22 @@ +/** + * Copyright (c) 2016 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.che.plugin.languageserver.shared.lsapi; + +import org.eclipse.che.dto.shared.DTO; + +import io.typefox.lsapi.TextDocumentContentChangeEvent; + +@DTO +@SuppressWarnings("all") +public interface TextDocumentContentChangeEventDTO extends TextDocumentContentChangeEvent { + /** + * Overridden to return the DTO type. + * + */ + public abstract RangeDTO getRange(); +} diff --git a/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/TextDocumentIdentifierDTO.java b/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/TextDocumentIdentifierDTO.java new file mode 100644 index 00000000000..7e044f5765b --- /dev/null +++ b/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/TextDocumentIdentifierDTO.java @@ -0,0 +1,17 @@ +/** + * Copyright (c) 2016 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.che.plugin.languageserver.shared.lsapi; + +import org.eclipse.che.dto.shared.DTO; + +import io.typefox.lsapi.TextDocumentIdentifier; + +@DTO +@SuppressWarnings("all") +public interface TextDocumentIdentifierDTO extends TextDocumentIdentifier { +} diff --git a/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/TextDocumentItemDTO.java b/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/TextDocumentItemDTO.java new file mode 100644 index 00000000000..9305e5b3824 --- /dev/null +++ b/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/TextDocumentItemDTO.java @@ -0,0 +1,17 @@ +/** + * Copyright (c) 2016 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.che.plugin.languageserver.shared.lsapi; + +import org.eclipse.che.dto.shared.DTO; + +import io.typefox.lsapi.TextDocumentItem; + +@DTO +@SuppressWarnings("all") +public interface TextDocumentItemDTO extends TextDocumentItem { +} diff --git a/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/TextDocumentPositionParamsDTO.java b/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/TextDocumentPositionParamsDTO.java new file mode 100644 index 00000000000..909591118ad --- /dev/null +++ b/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/TextDocumentPositionParamsDTO.java @@ -0,0 +1,28 @@ +/** + * Copyright (c) 2016 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.che.plugin.languageserver.shared.lsapi; + +import org.eclipse.che.dto.shared.DTO; + +import io.typefox.lsapi.TextDocumentPositionParams; + +@DTO +@SuppressWarnings("all") +public interface TextDocumentPositionParamsDTO extends TextDocumentPositionParams { + /** + * Overridden to return the DTO type. + * + */ + public abstract TextDocumentIdentifierDTO getTextDocument(); + + /** + * Overridden to return the DTO type. + * + */ + public abstract PositionDTO getPosition(); +} diff --git a/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/TextEditDTO.java b/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/TextEditDTO.java new file mode 100644 index 00000000000..e112edf03b8 --- /dev/null +++ b/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/TextEditDTO.java @@ -0,0 +1,22 @@ +/** + * Copyright (c) 2016 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.che.plugin.languageserver.shared.lsapi; + +import org.eclipse.che.dto.shared.DTO; + +import io.typefox.lsapi.TextEdit; + +@DTO +@SuppressWarnings("all") +public interface TextEditDTO extends TextEdit { + /** + * Overridden to return the DTO type. + * + */ + public abstract RangeDTO getRange(); +} diff --git a/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/VersionedTextDocumentIdentifierDTO.java b/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/VersionedTextDocumentIdentifierDTO.java new file mode 100644 index 00000000000..943d1e6da9d --- /dev/null +++ b/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/VersionedTextDocumentIdentifierDTO.java @@ -0,0 +1,17 @@ +/** + * Copyright (c) 2016 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.che.plugin.languageserver.shared.lsapi; + +import org.eclipse.che.dto.shared.DTO; + +import io.typefox.lsapi.VersionedTextDocumentIdentifier; + +@DTO +@SuppressWarnings("all") +public interface VersionedTextDocumentIdentifierDTO extends VersionedTextDocumentIdentifier { +} diff --git a/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/WorkspaceEditDTO.java b/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/WorkspaceEditDTO.java new file mode 100644 index 00000000000..9a2c79df3a1 --- /dev/null +++ b/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/WorkspaceEditDTO.java @@ -0,0 +1,22 @@ +/** + * Copyright (c) 2016 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.che.plugin.languageserver.shared.lsapi; + +import java.util.Map; + +import org.eclipse.che.dto.shared.DTO; + +import io.typefox.lsapi.WorkspaceEdit; + +@DTO +@SuppressWarnings("all") +public interface WorkspaceEditDTO extends WorkspaceEdit { + + @Override + Map getChanges(); +} diff --git a/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/WorkspaceSymbolParamsDTO.java b/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/WorkspaceSymbolParamsDTO.java new file mode 100644 index 00000000000..655e86e651b --- /dev/null +++ b/plugins/plugin-languageserver/che-plugin-languageserver-shared/src/main/java/org/eclipse/che/plugin/languageserver/shared/lsapi/WorkspaceSymbolParamsDTO.java @@ -0,0 +1,17 @@ +/** + * Copyright (c) 2016 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.che.plugin.languageserver.shared.lsapi; + +import org.eclipse.che.dto.shared.DTO; + +import io.typefox.lsapi.WorkspaceSymbolParams; + +@DTO +@SuppressWarnings("all") +public interface WorkspaceSymbolParamsDTO extends WorkspaceSymbolParams { +} diff --git a/plugins/plugin-languageserver/pom.xml b/plugins/plugin-languageserver/pom.xml new file mode 100644 index 00000000000..83efaf3ec1b --- /dev/null +++ b/plugins/plugin-languageserver/pom.xml @@ -0,0 +1,48 @@ + + + + 4.0.0 + + che-plugin-parent + org.eclipse.che.plugin + 4.3.0-RC1-SNAPSHOT + ../pom.xml + + che-plugin-languageserver-parent + pom + Che Plugin :: Language Server :: Parent + + che-plugin-languageserver-shared + che-plugin-languageserver-server + che-plugin-languageserver-ide + + + + + + org.eclipse.che.core + che-core-api-dto-maven-plugin + ${project.version} + + + com.mycila + license-maven-plugin + + true + + + + + + diff --git a/plugins/pom.xml b/plugins/pom.xml index 9db12eb5d18..b266283096e 100644 --- a/plugins/pom.xml +++ b/plugins/pom.xml @@ -46,5 +46,6 @@ plugin-cpp plugin-nodejs plugin-ssh-machine + plugin-languageserver diff --git a/pom.xml b/pom.xml index 8a7fce2bbd0..9dc3cb6960c 100644 --- a/pom.xml +++ b/pom.xml @@ -41,6 +41,17 @@ + + io.typefox.lsapi + io.typefox.lsapi + 0.1.0-SNAPSHOT + + + io.typefox.lsapi + io.typefox.lsapi + 0.1.0-SNAPSHOT + source + org.eclipse.che assembly-ide-war @@ -478,6 +489,21 @@ che-plugin-java-plain-shared ${project.version} + + org.eclipse.che.plugin + che-plugin-languageserver-ide + ${project.version} + + + org.eclipse.che.plugin + che-plugin-languageserver-server + ${project.version} + + + org.eclipse.che.plugin + che-plugin-languageserver-shared + ${project.version} + org.eclipse.che.plugin che-plugin-machine-ext-client