org.eclipse.xtext.ide.server.rename.IRenameService2 Java Examples
The following examples show how to use
org.eclipse.xtext.ide.server.rename.IRenameService2.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: XLanguageServerImpl.java From n4js with Eclipse Public License 1.0 | 6 votes |
/** * Compute the rename edits. Executed in a read request. */ protected WorkspaceEdit rename(OpenFileContext ofc, RenameParams renameParams, CancelIndicator cancelIndicator) { URI uri = ofc.getURI(); IResourceServiceProvider resourceServiceProvider = getResourceServiceProvider(uri); XIRenameService renameServiceOld = getService(resourceServiceProvider, XIRenameService.class); if (renameServiceOld != null) { // The deprecated version 1 of IRenameService is no longer supported, because it requires an // XWorkspaceManager which we do no longer allow to access outside the builder: throw new UnsupportedOperationException(XIRenameService.class.getSimpleName() + " is no longer supported"); } IRenameService2 renameService2 = getService(resourceServiceProvider, IRenameService2.class); if ((renameService2 != null)) { IRenameService2.Options options = new IRenameService2.Options(); options.setLanguageServerAccess(access); options.setRenameParams(renameParams); options.setCancelIndicator(cancelIndicator); return renameService2.rename(options); } return new WorkspaceEdit(); }
Example #2
Source File: XLanguageServerImpl.java From n4js with Eclipse Public License 1.0 | 5 votes |
/** * Prepare the rename operation. Executed in a read request. */ protected Either<Range, PrepareRenameResult> prepareRename(OpenFileContext ofc, TextDocumentPositionParams params, CancelIndicator cancelIndicator) { URI uri = ofc.getURI(); IRenameService2 renameService = getService(uri, IRenameService2.class); if (renameService == null) { throw new UnsupportedOperationException(); } IRenameService2.PrepareRenameOptions options = new IRenameService2.PrepareRenameOptions(); options.setLanguageServerAccess(access); options.setParams(params); options.setCancelIndicator(cancelIndicator); return renameService.prepareRename(options); }
Example #3
Source File: LanguageServerImpl.java From xtext-core with Eclipse Public License 2.0 | 5 votes |
/** * Prepare the rename operation. Executed in a read request. * @since 2.20 */ protected Either<Range, PrepareRenameResult> prepareRename(PrepareRenameParams params, CancelIndicator cancelIndicator) { URI uri = getURI(params); IRenameService2 renameService = getService(uri, IRenameService2.class); if (renameService == null) { throw new UnsupportedOperationException(); } IRenameService2.PrepareRenameOptions options = new IRenameService2.PrepareRenameOptions(); options.setLanguageServerAccess(access); options.setParams(params); options.setCancelIndicator(cancelIndicator); return renameService.prepareRename(options); }
Example #4
Source File: LanguageServerImpl.java From xtext-core with Eclipse Public License 2.0 | 5 votes |
/** * Compute the rename edits. Executed in a read request. * @since 2.20 */ protected WorkspaceEdit rename(RenameParams renameParams, CancelIndicator cancelIndicator) { URI uri = getURI(renameParams.getTextDocument()); IResourceServiceProvider resourceServiceProvider = getResourceServiceProvider(uri); IRenameService2 renameService2 = getService(resourceServiceProvider, IRenameService2.class); if (renameService2 != null) { IRenameService2.Options options = new IRenameService2.Options(); options.setLanguageServerAccess(access); options.setRenameParams(renameParams); options.setCancelIndicator(cancelIndicator); return renameService2.rename(options); } return new WorkspaceEdit(); }
Example #5
Source File: LanguageServerImpl.java From xtext-core with Eclipse Public License 2.0 | 4 votes |
/** * Configure the server capabilities for this instance. * * @param params * the initialization parametrs * @return the server capabilities * @since 2.20 */ protected ServerCapabilities createServerCapabilities(InitializeParams params) { ServerCapabilities serverCapabilities = new ServerCapabilities(); serverCapabilities.setHoverProvider(true); serverCapabilities.setDefinitionProvider(true); serverCapabilities.setReferencesProvider(true); serverCapabilities.setDocumentSymbolProvider(true); serverCapabilities.setWorkspaceSymbolProvider(true); Set<? extends IResourceServiceProvider> allLanguages = getAllLanguages(); if (allLanguages.stream().anyMatch((serviceProvider) -> serviceProvider.get(ICodeLensService.class) != null)) { CodeLensOptions codeLensOptions = new CodeLensOptions(); codeLensOptions.setResolveProvider(allLanguages.stream() .anyMatch((serviceProvider) -> serviceProvider.get(ICodeLensResolver.class) != null)); serverCapabilities.setCodeLensProvider(codeLensOptions); } serverCapabilities.setCodeActionProvider(allLanguages.stream() .anyMatch((serviceProvider) -> serviceProvider.get(ICodeActionService2.class) != null)); serverCapabilities.setSignatureHelpProvider(new SignatureHelpOptions(ImmutableList.of("(", ","))); serverCapabilities.setTextDocumentSync(TextDocumentSyncKind.Incremental); CompletionOptions completionOptions = new CompletionOptions(); completionOptions.setResolveProvider(false); completionOptions.setTriggerCharacters(ImmutableList.of(".")); serverCapabilities.setCompletionProvider(completionOptions); serverCapabilities.setDocumentFormattingProvider(true); serverCapabilities.setDocumentRangeFormattingProvider(true); serverCapabilities.setDocumentHighlightProvider(true); ClientCapabilities clientCapabilities = null; if (params != null) { clientCapabilities = params.getCapabilities(); } TextDocumentClientCapabilities textDocument = null; if (clientCapabilities != null) { textDocument = clientCapabilities.getTextDocument(); } RenameCapabilities rename = null; if (textDocument != null) { rename = textDocument.getRename(); } Boolean prepareSupport = null; if (rename != null) { prepareSupport = rename.getPrepareSupport(); } boolean clientPrepareSupport = Objects.equal(Boolean.TRUE, prepareSupport); if (clientPrepareSupport && allLanguages.stream() .anyMatch(serviceProvider -> serviceProvider.get(IRenameService2.class) != null)) { RenameOptions renameOptions = new RenameOptions(); renameOptions.setPrepareProvider(true); serverCapabilities.setRenameProvider(Either.<Boolean, RenameOptions>forRight(renameOptions)); } else { serverCapabilities.setRenameProvider(Either.forLeft(allLanguages.stream() .anyMatch((serviceProvider) -> serviceProvider.get(IRenameService2.class) != null))); } WorkspaceClientCapabilities workspace = null; if (clientCapabilities != null) { workspace = clientCapabilities.getWorkspace(); } ExecuteCommandCapabilities executeCommand = null; if (workspace != null) { executeCommand = workspace.getExecuteCommand(); if (workspace.getWorkspaceFolders() == Boolean.TRUE && workspaceManager.isSupportsWorkspaceFolders()) { WorkspaceFoldersOptions workspaceFoldersOptions = new WorkspaceFoldersOptions(); workspaceFoldersOptions.setSupported(true); workspaceFoldersOptions.setChangeNotifications(true); serverCapabilities.setWorkspace(new WorkspaceServerCapabilities(workspaceFoldersOptions)); } } if (executeCommand != null) { commandRegistry.initialize(allLanguages, clientCapabilities, client); ExecuteCommandOptions executeCommandOptions = new ExecuteCommandOptions(); executeCommandOptions.setCommands(commandRegistry.getCommands()); serverCapabilities.setExecuteCommandProvider(executeCommandOptions); } semanticHighlightingRegistry.initialize(allLanguages, clientCapabilities, client); serverCapabilities.setSemanticHighlighting( new SemanticHighlightingServerCapabilities(semanticHighlightingRegistry.getAllScopes())); for (IResourceServiceProvider language : allLanguages) { ICapabilitiesContributor capabilitiesContributor = language.get(ICapabilitiesContributor.class); if (capabilitiesContributor != null) { capabilitiesContributor.contribute(serverCapabilities, params); } } return serverCapabilities; }
Example #6
Source File: AbstractSingleCodetemplateIdeModule.java From xtext-eclipse with Eclipse Public License 2.0 | 4 votes |
public Class<? extends IRenameService2> bindIRenameService2() { return RenameService2.class; }
Example #7
Source File: AbstractXtendIdeModule.java From xtext-xtend with Eclipse Public License 2.0 | 4 votes |
public Class<? extends IRenameService2> bindIRenameService2() { return RenameService2.class; }
Example #8
Source File: TestLanguageIdeModule.java From xtext-core with Eclipse Public License 2.0 | 4 votes |
@Override public Class<? extends IRenameService2> bindIRenameService2() { return TestLanguageRenameService.class; }
Example #9
Source File: AbstractRenameTestLanguageIdeModule.java From xtext-core with Eclipse Public License 2.0 | 4 votes |
public Class<? extends IRenameService2> bindIRenameService2() { return RenameService2.class; }
Example #10
Source File: AbstractIndentationAwareUiTestLanguageIdeModule.java From xtext-core with Eclipse Public License 2.0 | 4 votes |
public Class<? extends IRenameService2> bindIRenameService2() { return RenameService2.class; }
Example #11
Source File: AbstractPartialSerializationTestLanguageIdeModule.java From xtext-core with Eclipse Public License 2.0 | 4 votes |
public Class<? extends IRenameService2> bindIRenameService2() { return RenameService2.class; }
Example #12
Source File: AbstractPartialContentAssistTestLanguageIdeModule.java From xtext-core with Eclipse Public License 2.0 | 4 votes |
public Class<? extends IRenameService2> bindIRenameService2() { return RenameService2.class; }
Example #13
Source File: AbstractTestLanguageIdeModule.java From xtext-core with Eclipse Public License 2.0 | 4 votes |
public Class<? extends IRenameService2> bindIRenameService2() { return RenameService2.class; }
Example #14
Source File: AbstractXtextIdeModule.java From xtext-core with Eclipse Public License 2.0 | 4 votes |
public Class<? extends IRenameService2> bindIRenameService2() { return RenameService2.class; }
Example #15
Source File: AbstractBuilderTestLanguageIdeModule.java From xtext-eclipse with Eclipse Public License 2.0 | 4 votes |
public Class<? extends IRenameService2> bindIRenameService2() { return RenameService2.class; }
Example #16
Source File: AbstractFileAwareTestLanguageIdeModule.java From xtext-core with Eclipse Public License 2.0 | 4 votes |
public Class<? extends IRenameService2> bindIRenameService2() { return RenameService2.class; }
Example #17
Source File: AbstractXtextGrammarTestLanguageIdeModule.java From xtext-core with Eclipse Public License 2.0 | 4 votes |
public Class<? extends IRenameService2> bindIRenameService2() { return RenameService2.class; }
Example #18
Source File: AbstractNoJdtTestLanguageIdeModule.java From xtext-core with Eclipse Public License 2.0 | 4 votes |
public Class<? extends IRenameService2> bindIRenameService2() { return RenameService2.class; }
Example #19
Source File: AbstractNestedRefsTestLanguageIdeModule.java From xtext-core with Eclipse Public License 2.0 | 4 votes |
public Class<? extends IRenameService2> bindIRenameService2() { return RenameService2.class; }
Example #20
Source File: AbstractSARLIdeModule.java From sarl with Apache License 2.0 | 4 votes |
public Class<? extends IRenameService2> bindIRenameService2() { return RenameService2.class; }
Example #21
Source File: AbstractEcore2XtextTestIdeModule.java From xtext-eclipse with Eclipse Public License 2.0 | 4 votes |
public Class<? extends IRenameService2> bindIRenameService2() { return RenameService2.class; }
Example #22
Source File: AbstractN4JSIdeModule.java From n4js with Eclipse Public License 1.0 | 4 votes |
public Class<? extends IRenameService2> bindIRenameService2() { return RenameService2.class; }
Example #23
Source File: XLanguageServerImpl.java From n4js with Eclipse Public License 1.0 | 4 votes |
/** * Configure the server capabilities for this instance. * * @param params * the initialization parameters * @return the server capabilities */ protected ServerCapabilities createServerCapabilities(InitializeParams params) { ServerCapabilities serverCapabilities = new ServerCapabilities(); serverCapabilities.setHoverProvider(true); serverCapabilities.setDefinitionProvider(true); serverCapabilities.setReferencesProvider(true); serverCapabilities.setDocumentSymbolProvider(true); serverCapabilities.setWorkspaceSymbolProvider(true); Set<? extends IResourceServiceProvider> allLanguages = getAllLanguages(); if (allLanguages.stream().anyMatch((serviceProvider) -> serviceProvider.get(ICodeLensService.class) != null)) { CodeLensOptions codeLensOptions = new CodeLensOptions(); codeLensOptions.setResolveProvider(allLanguages.stream() .anyMatch((serviceProvider) -> serviceProvider.get(ICodeLensResolver.class) != null)); serverCapabilities.setCodeLensProvider(codeLensOptions); } boolean supportsCodeActions = allLanguages.stream() .anyMatch((serviceProvider) -> serviceProvider.get(ICodeActionService.class) != null || serviceProvider.get(ICodeActionService2.class) != null); if (supportsCodeActions) { Optional<List<String>> supportedKinds = getSupportedCodeActionKinds(); if (supportedKinds.isPresent()) { serverCapabilities.setCodeActionProvider(new CodeActionOptions(supportedKinds.get())); } else { serverCapabilities.setCodeActionProvider(true); } } else { serverCapabilities.setCodeActionProvider(false); } serverCapabilities.setSignatureHelpProvider(new SignatureHelpOptions(ImmutableList.of("(", ","))); serverCapabilities.setTextDocumentSync(TextDocumentSyncKind.Incremental); CompletionOptions completionOptions = new CompletionOptions(); completionOptions.setResolveProvider(false); completionOptions.setTriggerCharacters(ImmutableList.of(".")); serverCapabilities.setCompletionProvider(completionOptions); serverCapabilities.setDocumentFormattingProvider(true); serverCapabilities.setDocumentRangeFormattingProvider(true); serverCapabilities.setDocumentHighlightProvider(true); ClientCapabilities clientCapabilities = null; if (params != null) { clientCapabilities = params.getCapabilities(); } TextDocumentClientCapabilities textDocument = null; if (clientCapabilities != null) { textDocument = clientCapabilities.getTextDocument(); } RenameCapabilities rename = null; if (textDocument != null) { rename = textDocument.getRename(); } Boolean prepareSupport = null; if (rename != null) { prepareSupport = rename.getPrepareSupport(); } boolean clientPrepareSupport = Objects.equal(Boolean.TRUE, prepareSupport); if (clientPrepareSupport && allLanguages.stream() .anyMatch(serviceProvider -> serviceProvider.get(IRenameService2.class) != null)) { RenameOptions renameOptions = new RenameOptions(); renameOptions.setPrepareProvider(true); serverCapabilities.setRenameProvider(Either.<Boolean, RenameOptions> forRight(renameOptions)); } else { serverCapabilities.setRenameProvider(Either.forLeft(allLanguages.stream() .anyMatch((serviceProvider) -> serviceProvider.get(IRenameService.class) != null || serviceProvider.get(IRenameService2.class) != null))); } WorkspaceClientCapabilities workspace = null; if (clientCapabilities != null) { workspace = clientCapabilities.getWorkspace(); } ExecuteCommandCapabilities executeCommand = null; if (workspace != null) { executeCommand = workspace.getExecuteCommand(); } if (executeCommand != null) { commandRegistry.initialize(allLanguages, clientCapabilities, client); ExecuteCommandOptions executeCommandOptions = new ExecuteCommandOptions(); executeCommandOptions.setCommands(commandRegistry.getCommands()); serverCapabilities.setExecuteCommandProvider(executeCommandOptions); } semanticHighlightingRegistry.initialize(allLanguages, clientCapabilities, client); serverCapabilities.setSemanticHighlighting(new SemanticHighlightingServerCapabilities( semanticHighlightingRegistry.getAllScopes())); for (IResourceServiceProvider language : allLanguages) { ICapabilitiesContributor capabilitiesContributor = language.get(ICapabilitiesContributor.class); if (capabilitiesContributor != null) { capabilitiesContributor.contribute(serverCapabilities, params); } } return serverCapabilities; }
Example #24
Source File: AbstractJSONIdeModule.java From n4js with Eclipse Public License 1.0 | 4 votes |
public Class<? extends IRenameService2> bindIRenameService2() { return RenameService2.class; }
Example #25
Source File: AbstractTypesIdeModule.java From n4js with Eclipse Public License 1.0 | 4 votes |
public Class<? extends IRenameService2> bindIRenameService2() { return RenameService2.class; }
Example #26
Source File: AbstractPureXbaseIdeModule.java From xtext-extras with Eclipse Public License 2.0 | 4 votes |
public Class<? extends IRenameService2> bindIRenameService2() { return RenameService2.class; }
Example #27
Source File: AbstractXmlIdeModule.java From xtext-eclipse with Eclipse Public License 2.0 | 4 votes |
public Class<? extends IRenameService2> bindIRenameService2() { return RenameService2.class; }
Example #28
Source File: AbstractReferringTestLanguageIdeModule.java From xtext-eclipse with Eclipse Public License 2.0 | 4 votes |
public Class<? extends IRenameService2> bindIRenameService2() { return RenameService2.class; }
Example #29
Source File: AbstractRefactoringTestLanguageIdeModule.java From xtext-eclipse with Eclipse Public License 2.0 | 4 votes |
public Class<? extends IRenameService2> bindIRenameService2() { return RenameService2.class; }
Example #30
Source File: AbstractCodetemplatesIdeModule.java From xtext-eclipse with Eclipse Public License 2.0 | 4 votes |
public Class<? extends IRenameService2> bindIRenameService2() { return RenameService2.class; }