org.eclipse.lsp4j.services.WorkspaceService Java Examples
The following examples show how to use
org.eclipse.lsp4j.services.WorkspaceService.
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: ServerTest.java From xtext-core with Eclipse Public License 2.0 | 6 votes |
@Test public void testIncrementalDeletion() { StringConcatenation _builder = new StringConcatenation(); _builder.append("type Test {"); _builder.newLine(); _builder.append(" "); _builder.append("NonExisting foo"); _builder.newLine(); _builder.append("}"); _builder.newLine(); final String path = this.writeFile("MyType1.testlang", _builder); this.initialize(); this.assertEquals("Couldn\'t resolve reference to TypeDeclaration \'NonExisting\'.", IterableExtensions.<Diagnostic>head(IterableExtensions.<List<Diagnostic>>head(this.getDiagnostics().values())).getMessage()); this.deleteFile("MyType1.testlang"); WorkspaceService _workspaceService = this.languageServer.getWorkspaceService(); FileEvent _fileEvent = new FileEvent(path, FileChangeType.Deleted); DidChangeWatchedFilesParams _didChangeWatchedFilesParams = new DidChangeWatchedFilesParams(Collections.<FileEvent>unmodifiableList(CollectionLiterals.<FileEvent>newArrayList(_fileEvent))); _workspaceService.didChangeWatchedFiles(_didChangeWatchedFilesParams); Assert.assertTrue(IterableExtensions.<List<Diagnostic>>head(this.getDiagnostics().values()).isEmpty()); }
Example #2
Source File: IndexOnlyProjectTest.java From xtext-core with Eclipse Public License 2.0 | 6 votes |
/** * Shows that the resource is not validated during incremental build */ @Test public void testIncrementalBuildNoValidation() { StringConcatenation _builder = new StringConcatenation(); _builder.append("type Test {"); _builder.newLine(); _builder.append(" "); _builder.append("NonExisting foo"); _builder.newLine(); _builder.append("}"); _builder.newLine(); this.writeFile("MyType1.testlang", _builder); this.initialize(); Assert.assertTrue(IterableExtensions.join(this.getDiagnostics().entrySet(), ","), this.getDiagnostics().isEmpty()); StringConcatenation _builder_1 = new StringConcatenation(); _builder_1.append("type NonExisting {"); _builder_1.newLine(); _builder_1.append("}"); _builder_1.newLine(); final String path = this.writeFile("MyType2.testlang", _builder_1); WorkspaceService _workspaceService = this.languageServer.getWorkspaceService(); FileEvent _fileEvent = new FileEvent(path, FileChangeType.Created); DidChangeWatchedFilesParams _didChangeWatchedFilesParams = new DidChangeWatchedFilesParams(Collections.<FileEvent>unmodifiableList(CollectionLiterals.<FileEvent>newArrayList(_fileEvent))); _workspaceService.didChangeWatchedFiles(_didChangeWatchedFilesParams); Assert.assertTrue(IterableExtensions.join(this.getDiagnostics().entrySet(), ","), this.getDiagnostics().isEmpty()); }
Example #3
Source File: ServerTest.java From xtext-core with Eclipse Public License 2.0 | 5 votes |
@Test public void testTwoFilesDeleteClose() { final String fileURI = this.writeFile("Foo.testlang", ""); this.initialize(); final String referencingFileURI = this.getVirtualFile("Bar.testlang"); StringConcatenation _builder = new StringConcatenation(); _builder.append("type Bar {"); _builder.newLine(); _builder.append(" "); _builder.append("Foo foo"); _builder.newLine(); _builder.append("}"); _builder.newLine(); this.open(referencingFileURI, _builder.toString()); Assert.assertFalse("Bar.testlang references missing type Foo from Foo.testlang: expect error", this.getDiagnostics().get(referencingFileURI).isEmpty()); this.open(fileURI, "type Foo {}"); Assert.assertTrue("Bar.testlang references type Foo from Foo.testlang: expect no error", this.getDiagnostics().get(referencingFileURI).isEmpty()); this.deleteFile(fileURI); WorkspaceService _workspaceService = this.languageServer.getWorkspaceService(); FileEvent _fileEvent = new FileEvent(fileURI, FileChangeType.Deleted); DidChangeWatchedFilesParams _didChangeWatchedFilesParams = new DidChangeWatchedFilesParams(Collections.<FileEvent>unmodifiableList(CollectionLiterals.<FileEvent>newArrayList(_fileEvent))); _workspaceService.didChangeWatchedFiles(_didChangeWatchedFilesParams); Assert.assertTrue("delete file on disk: expect no error", this.getDiagnostics().get(referencingFileURI).isEmpty()); this.close(fileURI); Assert.assertFalse("close deleted file: expect error", this.getDiagnostics().get(referencingFileURI).isEmpty()); }
Example #4
Source File: ServerTest.java From xtext-core with Eclipse Public License 2.0 | 5 votes |
@Test public void testIncrementalBuildWithError() { StringConcatenation _builder = new StringConcatenation(); _builder.append("type Test {"); _builder.newLine(); _builder.append(" "); _builder.append("NonExisting foo"); _builder.newLine(); _builder.append("}"); _builder.newLine(); this.writeFile("MyType1.testlang", _builder); this.initialize(); this.assertEquals("Couldn\'t resolve reference to TypeDeclaration \'NonExisting\'.", IterableExtensions.<Diagnostic>head(IterableExtensions.<List<Diagnostic>>head(this.getDiagnostics().values())).getMessage()); StringConcatenation _builder_1 = new StringConcatenation(); _builder_1.append("type NonExisting {"); _builder_1.newLine(); _builder_1.append("}"); _builder_1.newLine(); final String path = this.writeFile("MyType2.testlang", _builder_1); WorkspaceService _workspaceService = this.languageServer.getWorkspaceService(); FileEvent _fileEvent = new FileEvent(path, FileChangeType.Created); DidChangeWatchedFilesParams _didChangeWatchedFilesParams = new DidChangeWatchedFilesParams(Collections.<FileEvent>unmodifiableList(CollectionLiterals.<FileEvent>newArrayList(_fileEvent))); _workspaceService.didChangeWatchedFiles(_didChangeWatchedFilesParams); Assert.assertNotNull(this.getDiagnostics().get(path)); final Function1<List<Diagnostic>, Boolean> _function = (List<Diagnostic> it) -> { return Boolean.valueOf(it.isEmpty()); }; Assert.assertTrue(IterableExtensions.join(this.getDiagnostics().values(), ","), IterableExtensions.<List<Diagnostic>>forall(this.getDiagnostics().values(), _function)); }
Example #5
Source File: OpenDocumentTest.java From xtext-core with Eclipse Public License 2.0 | 5 votes |
@Test public void testOpenedDocumentShadowsPersistedFile() { StringConcatenation _builder = new StringConcatenation(); _builder.append("type Test {"); _builder.newLine(); _builder.append(" "); _builder.append("NonExisting foo"); _builder.newLine(); _builder.append("}"); _builder.newLine(); final String firstFile = this.writeFile("MyType1.testlang", _builder); this.initialize(); this.assertEquals("Couldn\'t resolve reference to TypeDeclaration \'NonExisting\'.", IterableExtensions.<Diagnostic>head(this.getDiagnostics().get(firstFile)).getMessage()); StringConcatenation _builder_1 = new StringConcatenation(); _builder_1.append("type Foo {"); _builder_1.newLine(); _builder_1.append("}"); _builder_1.newLine(); final String path = this.writeFile("MyType2.testlang", _builder_1); WorkspaceService _workspaceService = this.languageServer.getWorkspaceService(); FileEvent _fileEvent = new FileEvent(path, FileChangeType.Created); DidChangeWatchedFilesParams _didChangeWatchedFilesParams = new DidChangeWatchedFilesParams( Collections.<FileEvent>unmodifiableList(CollectionLiterals.<FileEvent>newArrayList(_fileEvent))); _workspaceService.didChangeWatchedFiles(_didChangeWatchedFilesParams); this.assertEquals("Couldn\'t resolve reference to TypeDeclaration \'NonExisting\'.", IterableExtensions.<Diagnostic>head(this.getDiagnostics().get(firstFile)).getMessage()); StringConcatenation _builder_2 = new StringConcatenation(); _builder_2.append("type NonExisting {"); _builder_2.newLine(); _builder_2.append("}"); _builder_2.newLine(); this.open(path, _builder_2.toString()); Assert.assertNull(IterableExtensions.<Diagnostic>head(this.getDiagnostics().get(firstFile))); this.close(path); this.assertEquals("Couldn\'t resolve reference to TypeDeclaration \'NonExisting\'.", IterableExtensions.<Diagnostic>head(this.getDiagnostics().get(firstFile)).getMessage()); }
Example #6
Source File: ActionScriptLanguageServer.java From vscode-as3mxml with Apache License 2.0 | 5 votes |
/** * Requests from Visual Studio Code that are at the workspace level. */ @Override public WorkspaceService getWorkspaceService() { if (actionScriptServices == null) { actionScriptServices = new ActionScriptServices(); } return actionScriptServices; }
Example #7
Source File: DefaultRequestManager.java From lsp4intellij with Apache License 2.0 | 5 votes |
@Override public WorkspaceService getWorkspaceService() { if (checkStatus()) { try { return workspaceService; } catch (Exception e) { crashed(e); return null; } } else { return null; } }
Example #8
Source File: JDTLanguageServer.java From eclipse.jdt.ls with Eclipse Public License 2.0 | 4 votes |
@Override public WorkspaceService getWorkspaceService() { return this; }
Example #9
Source File: SarosLanguageServer.java From saros with GNU General Public License v2.0 | 4 votes |
@Override public WorkspaceService getWorkspaceService() { return new WorkspaceServiceStub(); }
Example #10
Source File: NullResponseTest.java From lsp4j with Eclipse Public License 2.0 | 4 votes |
@Override public WorkspaceService getWorkspaceService() { return null; }
Example #11
Source File: MockLanguageServer.java From lsp4j with Eclipse Public License 2.0 | 4 votes |
@Override public WorkspaceService getWorkspaceService() { return this; }
Example #12
Source File: LanguageServerImpl.java From xtext-core with Eclipse Public License 2.0 | 4 votes |
@Override public WorkspaceService getWorkspaceService() { return this; }
Example #13
Source File: SyntaxLanguageServer.java From eclipse.jdt.ls with Eclipse Public License 2.0 | 4 votes |
@Override public WorkspaceService getWorkspaceService() { return this; }
Example #14
Source File: TeiidDdlLanguageServer.java From syndesis with Apache License 2.0 | 4 votes |
/** * @return the workspaceService */ @Override public WorkspaceService getWorkspaceService() { return this.workspaceService; }
Example #15
Source File: LSPBindings.java From netbeans with Apache License 2.0 | 4 votes |
public WorkspaceService getWorkspaceService() { return server.getWorkspaceService(); }
Example #16
Source File: Server.java From netbeans with Apache License 2.0 | 4 votes |
@Override public WorkspaceService getWorkspaceService() { return new WorkspaceServiceImpl(); }
Example #17
Source File: XLanguageServerImpl.java From n4js with Eclipse Public License 1.0 | 4 votes |
@Override public WorkspaceService getWorkspaceService() { return this; }
Example #18
Source File: RdfLintLanguageServer.java From rdflint with MIT License | 4 votes |
@Override public WorkspaceService getWorkspaceService() { return this; }
Example #19
Source File: CamelLanguageServer.java From camel-language-server with Apache License 2.0 | 4 votes |
@Override public WorkspaceService getWorkspaceService() { return super.getWorkspaceService(); }
Example #20
Source File: AbstractLanguageServer.java From camel-language-server with Apache License 2.0 | 4 votes |
/** * @param workspaceService the workspaceService to set */ protected void setWorkspaceService(WorkspaceService workspaceService) { this.workspaceService = workspaceService; }
Example #21
Source File: AbstractLanguageServer.java From camel-language-server with Apache License 2.0 | 4 votes |
/** * @return the workspaceService */ protected WorkspaceService getWorkspaceService() { return this.workspaceService; }
Example #22
Source File: XMLLanguageServer.java From lemminx with Eclipse Public License 2.0 | 4 votes |
@Override public WorkspaceService getWorkspaceService() { return xmlWorkspaceService; }
Example #23
Source File: GroovyLanguageServer.java From groovy-language-server with Apache License 2.0 | 4 votes |
@Override public WorkspaceService getWorkspaceService() { return groovyServices; }