org.eclipse.lsp4j.DidSaveTextDocumentParams Java Examples
The following examples show how to use
org.eclipse.lsp4j.DidSaveTextDocumentParams.
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: DocumentContentSynchronizer.java From intellij-quarkus with Eclipse Public License 2.0 | 5 votes |
public void documentSaved(long timestamp) { this.modificationStamp = timestamp; ServerCapabilities serverCapabilities = languageServerWrapper.getServerCapabilities(); if(serverCapabilities != null ) { Either<TextDocumentSyncKind, TextDocumentSyncOptions> textDocumentSync = serverCapabilities.getTextDocumentSync(); if(textDocumentSync.isRight() && textDocumentSync.getRight().getSave() == null) { return; } } TextDocumentIdentifier identifier = new TextDocumentIdentifier(fileUri.toString()); DidSaveTextDocumentParams params = new DidSaveTextDocumentParams(identifier, document.getText()); languageServerWrapper.getInitializedServer().thenAcceptAsync(ls -> ls.getTextDocumentService().didSave(params)); }
Example #2
Source File: XMLTextDocumentService.java From lemminx with Eclipse Public License 2.0 | 5 votes |
@Override public void didSave(DidSaveTextDocumentParams params) { computeAsync((monitor) -> { // A document was saved, collect documents to revalidate SaveContext context = new SaveContext(params.getTextDocument().getUri()); doSave(context); return null; }); }
Example #3
Source File: BaseDocumentLifeCycleHandler.java From eclipse.jdt.ls with Eclipse Public License 2.0 | 5 votes |
public void didSave(DidSaveTextDocumentParams params) { ISchedulingRule rule = JDTUtils.getRule(params.getTextDocument().getUri()); try { JobHelpers.waitForJobs(DocumentLifeCycleHandler.DOCUMENT_LIFE_CYCLE_JOBS, new NullProgressMonitor()); ResourcesPlugin.getWorkspace().run(new IWorkspaceRunnable() { @Override public void run(IProgressMonitor monitor) throws CoreException { handleSaved(params); } }, rule, IWorkspace.AVOID_UPDATE, new NullProgressMonitor()); } catch (CoreException e) { JavaLanguageServerPlugin.logException("Handle document save ", e); } }
Example #4
Source File: DiagnosticRunner.java From camel-language-server with Apache License 2.0 | 5 votes |
private String retrieveFullText(DidSaveTextDocumentParams params) { String camelText = params.getText(); if (camelText == null) { camelText = camelLanguageServer.getTextDocumentService().getOpenedDocument(params.getTextDocument().getUri()).getText(); } return camelText; }
Example #5
Source File: UnknownPropertyQuickfixTest.java From camel-language-server with Apache License 2.0 | 5 votes |
private TextDocumentIdentifier initAnLaunchDiagnostic() throws FileNotFoundException { File f = new File("src/test/resources/workspace/diagnostic/camel-with-unknownParameter.xml"); camelLanguageServer = initializeLanguageServer(new FileInputStream(f), ".xml"); TextDocumentIdentifier textDocumentIdentifier = new TextDocumentIdentifier(DUMMY_URI+".xml"); DidSaveTextDocumentParams params = new DidSaveTextDocumentParams(textDocumentIdentifier); camelLanguageServer.getTextDocumentService().didSave(params); await().timeout(AWAIT_TIMEOUT).untilAsserted(() -> assertThat(lastPublishedDiagnostics).isNotNull()); await().timeout(AWAIT_TIMEOUT).untilAsserted(() -> assertThat(lastPublishedDiagnostics.getDiagnostics()).hasSize(1)); return textDocumentIdentifier; }
Example #6
Source File: InvalidEnumQuickfixTest.java From camel-language-server with Apache License 2.0 | 5 votes |
private TextDocumentIdentifier initAnLaunchDiagnostic() throws FileNotFoundException { File f = new File("src/test/resources/workspace/diagnostic/camel-with-invalid-enum.xml"); camelLanguageServer = initializeLanguageServer(new FileInputStream(f), ".xml"); TextDocumentIdentifier textDocumentIdentifier = new TextDocumentIdentifier(DUMMY_URI+".xml"); DidSaveTextDocumentParams params = new DidSaveTextDocumentParams(textDocumentIdentifier); camelLanguageServer.getTextDocumentService().didSave(params); await().timeout(AWAIT_TIMEOUT).untilAsserted(() -> assertThat(lastPublishedDiagnostics).isNotNull()); await().timeout(AWAIT_TIMEOUT).untilAsserted(() -> assertThat(lastPublishedDiagnostics.getDiagnostics()).hasSize(1)); return textDocumentIdentifier; }
Example #7
Source File: AbstractDiagnosticTest.java From camel-language-server with Apache License 2.0 | 5 votes |
protected void testDiagnostic(String fileUnderTest, int expectedNumberOfError, String extension) throws FileNotFoundException { File f = new File("src/test/resources/workspace/diagnostic/" + fileUnderTest + extension); camelLanguageServer = initializeLanguageServer(new FileInputStream(f), extension); DidSaveTextDocumentParams params = new DidSaveTextDocumentParams(new TextDocumentIdentifier(DUMMY_URI+extension)); camelLanguageServer.getTextDocumentService().didSave(params); await().timeout(AWAIT_TIMEOUT).untilAsserted(() -> assertThat(lastPublishedDiagnostics).isNotNull()); await().timeout(AWAIT_TIMEOUT).untilAsserted(() -> assertThat(lastPublishedDiagnostics.getDiagnostics()).hasSize(expectedNumberOfError)); }
Example #8
Source File: EditorEventManager.java From lsp4intellij with Apache License 2.0 | 5 votes |
/** * Notifies the server that the corresponding document has been saved */ public void documentSaved() { pool(() -> { if (!editor.isDisposed()) { DidSaveTextDocumentParams params = new DidSaveTextDocumentParams(identifier, editor.getDocument().getText()); requestManager.didSave(params); } }); }
Example #9
Source File: AbstractIdeTest.java From n4js with Eclipse Public License 1.0 | 5 votes |
/** Save the given, open file's in-memory content to disk. Does *not* close the file. */ protected void saveOpenedFile(FileURI fileURI) { if (!isOpen(fileURI)) { Assert.fail("file is not open: " + fileURI); } OpenFileInfo info = openFiles.get(fileURI); // 1) save current content to disk changeFileOnDiskWithoutNotification(fileURI, info.content); // 2) notify LSP server VersionedTextDocumentIdentifier docId = new VersionedTextDocumentIdentifier(fileURI.toString(), info.version); DidSaveTextDocumentParams params = new DidSaveTextDocumentParams(docId); languageServer.didSave(params); }
Example #10
Source File: DocumentLifeCycleHandlerTest.java From eclipse.jdt.ls with Eclipse Public License 2.0 | 5 votes |
private void saveDocument(ICompilationUnit cu) throws Exception { DidSaveTextDocumentParams saveParms = new DidSaveTextDocumentParams(); TextDocumentIdentifier textDocument = new TextDocumentIdentifier(); textDocument.setUri(JDTUtils.toURI(cu)); saveParms.setTextDocument(textDocument); saveParms.setText(cu.getSource()); lifeCycleHandler.didSave(saveParms); waitForBackgroundJobs(); }
Example #11
Source File: JDTLanguageServer.java From eclipse.jdt.ls with Eclipse Public License 2.0 | 4 votes |
@Override public void didSave(DidSaveTextDocumentParams params) { logInfo(">> document/didSave"); documentLifeCycleHandler.didSave(params); }
Example #12
Source File: LSPBuilder.java From n4js with Eclipse Public License 1.0 | 4 votes |
public void didSave(DidSaveTextDocumentParams params) { runBuildable("didSave", () -> toBuildable(params)); }
Example #13
Source File: SyntaxLanguageServer.java From eclipse.jdt.ls with Eclipse Public License 2.0 | 4 votes |
@Override public void didSave(DidSaveTextDocumentParams params) { logInfo(">> document/didSave"); documentLifeCycleHandler.didSave(params); }
Example #14
Source File: ActionScriptServices.java From vscode-as3mxml with Apache License 2.0 | 4 votes |
/** * Called when a file being edited is saved. */ @Override public void didSave(DidSaveTextDocumentParams params) { if(realTimeProblems) { //as long as we're checking on change, we shouldn't need to do //anything on save because we should already have the correct state return; } TextDocumentIdentifier textDocument = params.getTextDocument(); String textDocumentUri = textDocument.getUri(); if (!textDocumentUri.endsWith(FILE_EXTENSION_AS) && !textDocumentUri.endsWith(FILE_EXTENSION_MXML)) { //code intelligence is available only in .as and .mxml files //so we ignore other file extensions return; } Path path = LanguageServerCompilerUtils.getPathFromLanguageServerURI(textDocumentUri); if (path == null) { return; } WorkspaceFolderData folderData = workspaceFolderManager.getWorkspaceFolderDataForSourceFile(path); if (folderData == null) { return; } getProject(folderData); ILspProject project = folderData.project; if (project == null) { //something went wrong while creating the project return; } //if it's an included file, switch to the parent file IncludeFileData includeFileData = folderData.includedFiles.get(path.toString()); if (includeFileData != null) { path = Paths.get(includeFileData.parentPath); } checkProjectForProblems(folderData); }
Example #15
Source File: LanguageServerImpl.java From xtext-core with Eclipse Public License 2.0 | 4 votes |
@Override public void didSave(DidSaveTextDocumentParams params) { // nothing to do }
Example #16
Source File: MockLanguageServer.java From lsp4j with Eclipse Public License 2.0 | 4 votes |
@Override public void didSave(DidSaveTextDocumentParams params) { }
Example #17
Source File: DocumentServiceStub.java From saros with GNU General Public License v2.0 | 4 votes |
@Override public void didSave(DidSaveTextDocumentParams params) { System.out.println("didSave"); }
Example #18
Source File: TeiidDdlTextDocumentService.java From syndesis with Apache License 2.0 | 4 votes |
@Override public void didSave(DidSaveTextDocumentParams params) { LOGGER.debug("didSave: {}", params.getTextDocument()); }
Example #19
Source File: TextDocumentServiceImpl.java From netbeans with Apache License 2.0 | 4 votes |
@Override public void didSave(DidSaveTextDocumentParams arg0) { //TODO: nothing for now? }
Example #20
Source File: LSPBuilder.java From n4js with Eclipse Public License 1.0 | 4 votes |
/** * Evaluate the params and deduce the respective build command. */ protected XBuildable toBuildable(DidSaveTextDocumentParams params) { return workspaceManager.didSave(getURI(params.getTextDocument())); }
Example #21
Source File: XLanguageServerImpl.java From n4js with Eclipse Public License 1.0 | 4 votes |
@Override public void didSave(DidSaveTextDocumentParams params) { lspBuilder.didSave(params); }
Example #22
Source File: RdfLintLanguageServer.java From rdflint with MIT License | 4 votes |
@Override public void didSave(DidSaveTextDocumentParams params) { // refresh all tripleset refreshFileTripleSet(); }
Example #23
Source File: DiagnosticRunner.java From camel-language-server with Apache License 2.0 | 4 votes |
public void compute(DidSaveTextDocumentParams params) { String camelText = retrieveFullText(params); computeDiagnostics(camelText, params.getTextDocument().getUri()); }
Example #24
Source File: CamelTextDocumentService.java From camel-language-server with Apache License 2.0 | 4 votes |
@Override public void didSave(DidSaveTextDocumentParams params) { LOGGER.info("didSave: {}", params.getTextDocument()); new DiagnosticRunner(getCamelCatalog(), camelLanguageServer).compute(params); }
Example #25
Source File: GroovyServices.java From groovy-language-server with Apache License 2.0 | 4 votes |
@Override public void didSave(DidSaveTextDocumentParams params) { // nothing to handle on save at this time }
Example #26
Source File: TextDocumentService.java From lsp4j with Eclipse Public License 2.0 | 2 votes |
/** * The document save notification is sent from the client to the server when * the document for saved in the client. * * Registration Options: TextDocumentSaveRegistrationOptions */ @JsonNotification void didSave(DidSaveTextDocumentParams params);