Skip to content

Commit

Permalink
Merge pull request #51 from itemis/cd_xtext216
Browse files Browse the repository at this point in the history
- update to Xtext 2.16
  • Loading branch information
cdietrich authored Dec 4, 2018
2 parents d8b2e28 + 355b0a8 commit 17acfdc
Show file tree
Hide file tree
Showing 8 changed files with 8 additions and 58 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ node {
// Configuration for Xtext projects
configure(subprojects.findAll { it.name.startsWith('org.xtext') }) {

ext.xtextVersion = '2.15.0'
ext.xtextVersion = '2.16.0'
repositories {
maven {
url 'https://oss.sonatype.org/content/repositories/snapshots'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class EclipseLikeHoverService extends HoverService {
@Inject extension IEObjectDocumentationProvider
@Inject INameLabelProvider nameLabelProvider

override def List<String> getContents(EObject element) {
override List<String> getContents(EObject element) {
val documentation = element.documentation
if(documentation === null) #[getFirstLine(element)] else #[getFirstLine(element), documentation]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import com.google.inject.util.Modules

class MultiProjectServerLauncher {

private static boolean IS_DEBUG = false
static boolean IS_DEBUG = false

def static void main(String[] args) {
val stdin = System.in
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import org.eclipse.emf.common.util.URI
import org.eclipse.lsp4j.CodeAction
import org.eclipse.lsp4j.CodeActionKind
import org.eclipse.lsp4j.CodeActionParams
import org.eclipse.lsp4j.TextDocumentEdit
import org.eclipse.lsp4j.TextEdit
import org.eclipse.lsp4j.WorkspaceEdit
import org.eclipse.lsp4j.jsonrpc.messages.Either
Expand All @@ -13,7 +12,6 @@ import org.eclipse.xtext.ide.server.codeActions.ICodeActionService
import org.eclipse.xtext.resource.XtextResource
import org.eclipse.xtext.util.CancelIndicator
import org.xtext.example.mydsl.validation.MyDslValidator
import org.eclipse.lsp4j.Position

class MyDslCodeActionService implements ICodeActionService {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ package org.xtext.example.mydsl.ide
import org.eclipse.xtext.ide.editor.contentassist.IdeContentProposalProvider
import org.eclipse.xtext.ide.server.codeActions.ICodeActionService
import org.eclipse.xtext.ide.server.commands.IExecutableCommandService
import org.eclipse.xtext.ide.server.contentassist.ContentAssistService
import org.eclipse.xtext.ide.server.hover.HoverService
import org.xtext.example.mydsl.ide.contentassist.CustomContentAssistService
import org.xtext.example.mydsl.ide.contentassist.MyDslIdeContentProposalProvider

/**
Expand All @@ -28,11 +26,6 @@ class MyDslIdeModule extends AbstractMyDslIdeModule {
return MyDslCodeActionService
}

// workaround for https://github.com/eclipse/xtext-eclipse/issues/834
def Class<? extends ContentAssistService> bindContentAssistService() {
return CustomContentAssistService
}

def Class<? extends IdeContentProposalProvider> bindIdeContentProposalProvider() {
MyDslIdeContentProposalProvider
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import org.eclipse.xtext.ide.server.ServerModule
*/
class ServerLauncher {

private static boolean IS_DEBUG = true
static boolean IS_DEBUG = true

def static void main(String[] args) {
//IS_DEBUG = args.exists[it == 'debug']
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package org.xtext.example.mydsl.ide.contentassist
import com.google.inject.Inject
import org.eclipse.xtext.RuleCall
import org.eclipse.xtext.ide.editor.contentassist.ContentAssistContext
import org.eclipse.xtext.ide.editor.contentassist.ContentAssistEntry
import org.eclipse.xtext.ide.editor.contentassist.IIdeContentProposalAcceptor
import org.eclipse.xtext.ide.editor.contentassist.IdeContentProposalProvider
import org.eclipse.xtext.scoping.IScopeProvider
Expand All @@ -20,24 +19,15 @@ class MyDslIdeContentProposalProvider extends IdeContentProposalProvider {
IIdeContentProposalAcceptor acceptor) {
if (greetingRule == ruleCall.rule) {
val scope = scopeProvider.getScope(context.currentModel, MyDslPackage.Literals.GREETING__FROM)

acceptor.accept(
proposalCreator.
createProposal('''Hello ${1|A,B,C|} from ${2|«scope.allElements.map[name.toString].join(",")»|}!''',
context) => [
kind = ContentAssistEntry.KIND_SNIPPET
label = "New Greeting (Template with Choice)"
], 0)
createSnippet('''Hello ${1|A,B,C|} from ${2|«scope.allElements.map[name.toString].join(",")»|}!''',
"New Greeting (Template with Choice)", context), 0)
acceptor.accept(
proposalCreator.
createProposal('''Hello ${1:name} from ${2:fromName}!''',
context) => [
kind = ContentAssistEntry.KIND_SNIPPET
label = "New Greeting (Template with Placeholder)"
], 0)
proposalCreator.createSnippet('''Hello ${1:name} from ${2:fromName}!''',
"New Greeting (Template with Placeholder)", context), 0)
}
super._createProposals(ruleCall, context, acceptor)

}

}

0 comments on commit 17acfdc

Please sign in to comment.