org.eclipse.lsp4j.DidChangeTextDocumentParams Java Examples

The following examples show how to use org.eclipse.lsp4j.DidChangeTextDocumentParams. 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: FileContentsTracker.java    From groovy-language-server with Apache License 2.0 7 votes vote down vote up
public void didChange(DidChangeTextDocumentParams params) {
	URI uri = URI.create(params.getTextDocument().getUri());
	String oldText = openFiles.get(uri);
	TextDocumentContentChangeEvent change = params.getContentChanges().get(0);
	Range range = change.getRange();
	if (range == null) {
		openFiles.put(uri, change.getText());
	} else {
		int offset = Positions.getOffset(oldText, change.getRange().getStart());
		StringBuilder builder = new StringBuilder();
		builder.append(oldText.substring(0, offset));
		builder.append(change.getText());
		builder.append(oldText.substring(offset + change.getRangeLength()));
		openFiles.put(uri, builder.toString());
	}
	changedFiles.add(uri);
}
 
Example #2
Source File: SemanticHighlightingTest.java    From eclipse.jdt.ls with Eclipse Public License 2.0 6 votes vote down vote up
protected void changeDocument(ICompilationUnit unit, String content, int version, Range range, int length) {
	DidChangeTextDocumentParams changeParms = new DidChangeTextDocumentParams();
	VersionedTextDocumentIdentifier textDocument = new VersionedTextDocumentIdentifier();
	textDocument.setUri(JDTUtils.toURI(unit));
	textDocument.setVersion(version);
	changeParms.setTextDocument(textDocument);
	TextDocumentContentChangeEvent event = new TextDocumentContentChangeEvent();
	if (range != null) {
		event.setRange(range);
		event.setRangeLength(length);
	}
	event.setText(content);
	List<TextDocumentContentChangeEvent> contentChanges = new ArrayList<>();
	contentChanges.add(event);
	changeParms.setContentChanges(contentChanges);
	lifeCycleHandler.didChange(changeParms);
}
 
Example #3
Source File: DocumentContentSynchronizer.java    From intellij-quarkus with Eclipse Public License 2.0 6 votes vote down vote up
@Override
public void documentChanged(DocumentEvent event) {
    checkEvent(event);
    if (syncKind == TextDocumentSyncKind.Full) {
        createChangeEvent(event);
    }

    if (changeParams != null) {
        final DidChangeTextDocumentParams changeParamsToSend = changeParams;
        changeParams = null;

        changeParamsToSend.getTextDocument().setVersion(++version);
        languageServerWrapper.getInitializedServer()
                .thenAcceptAsync(ls -> ls.getTextDocumentService().didChange(changeParamsToSend));
    }
}
 
Example #4
Source File: TextDocumentServiceImpl.java    From netbeans with Apache License 2.0 6 votes vote down vote up
@Override
public void didChange(DidChangeTextDocumentParams params) {
    Document doc = openedDocuments.get(params.getTextDocument().getUri());
    NbDocument.runAtomic((StyledDocument) doc, () -> {
        for (TextDocumentContentChangeEvent change : params.getContentChanges()) {
            try {
                int start = getOffset(doc, change.getRange().getStart());
                int end   = getOffset(doc, change.getRange().getEnd());
                doc.remove(start, end - start);
                doc.insertString(start, change.getText(), null);
            } catch (BadLocationException ex) {
                throw new IllegalStateException(ex);
            }
        }
    });
    runDiagnoticTasks(params.getTextDocument().getUri());
}
 
Example #5
Source File: DocumentLifeCycleHandlerTest.java    From eclipse.jdt.ls with Eclipse Public License 2.0 6 votes vote down vote up
private void changeDocument(ICompilationUnit cu, String content, int version, Range range, int length) throws JavaModelException {
	DidChangeTextDocumentParams changeParms = new DidChangeTextDocumentParams();
	VersionedTextDocumentIdentifier textDocument = new VersionedTextDocumentIdentifier();
	textDocument.setUri(JDTUtils.toURI(cu));
	textDocument.setVersion(version);
	changeParms.setTextDocument(textDocument);
	TextDocumentContentChangeEvent event = new TextDocumentContentChangeEvent();
	if (range != null) {
		event.setRange(range);
		event.setRangeLength(length);
	}
	event.setText(content);
	List<TextDocumentContentChangeEvent> contentChanges = new ArrayList<>();
	contentChanges.add(event);
	changeParms.setContentChanges(contentChanges);
	lifeCycleHandler.didChange(changeParms);
}
 
Example #6
Source File: AbstractIdeTest.java    From n4js with Eclipse Public License 1.0 6 votes vote down vote up
private void changeOpenedFile(FileURI fileURI, Function<String, String> modification,
		BiFunction<String, String, List<TextDocumentContentChangeEvent>> changeComputer) {
	if (!isOpen(fileURI)) {
		Assert.fail("file is not open: " + fileURI);
	}
	// 1) change in memory (i.e. in map 'openFiles')
	OpenFileInfo info = openFiles.get(fileURI);
	int oldVersion = info.version;
	String oldContent = info.content;
	int newVersion = oldVersion + 1;
	String newContent = modification.apply(oldContent);
	Assert.assertNotNull(newContent);
	info.version = newVersion;
	info.content = newContent;
	// 2) notify LSP server
	VersionedTextDocumentIdentifier docId = new VersionedTextDocumentIdentifier(fileURI.toString(), newVersion);
	List<TextDocumentContentChangeEvent> changes = changeComputer.apply(oldContent, newContent);
	DidChangeTextDocumentParams params = new DidChangeTextDocumentParams(docId, changes);
	languageServer.didChange(params);
}
 
Example #7
Source File: AbstractIdeTest.java    From n4js with Eclipse Public License 1.0 6 votes vote down vote up
private void closeFile(FileURI fileURI, boolean discardChanges) {
	if (!isOpen(fileURI)) {
		Assert.fail("trying to close a file that is not open: " + fileURI);
	}
	boolean dirty = isDirty(fileURI);
	if (dirty && !discardChanges) {
		Assert.fail("trying to close a file with unsaved changes: " + fileURI);
	} else if (!dirty && discardChanges) {
		Assert.fail("no unsaved changes to discard in file: " + fileURI);
	}

	OpenFileInfo info = openFiles.remove(fileURI);
	if (dirty) {
		// when closing a file with unsaved changes, LSP clients send a 'textDocument/didChange' to bring its
		// content back to the content on disk
		String contentOnDisk = getContentOfFileOnDisk(fileURI);
		DidChangeTextDocumentParams params = new DidChangeTextDocumentParams(
				new VersionedTextDocumentIdentifier(fileURI.toString(), info.version + 1),
				Collections.singletonList(new TextDocumentContentChangeEvent(contentOnDisk)));
		languageServer.didChange(params);
	}
	languageServer.didClose(new DidCloseTextDocumentParams(new TextDocumentIdentifier(fileURI.toString())));
	joinServerRequests();
}
 
Example #8
Source File: CamelTextDocumentServiceTest.java    From camel-language-server with Apache License 2.0 6 votes vote down vote up
@Test
void testChangeEventUpdatesStoredText() throws Exception {
	CamelLanguageServer camelLanguageServer = initializeLanguageServer("<to uri=\"\" xmlns=\"http://camel.apache.org/schema/blueprint\"></to>\n");
	
	DidChangeTextDocumentParams changeEvent = new DidChangeTextDocumentParams();
	VersionedTextDocumentIdentifier textDocument = new VersionedTextDocumentIdentifier();
	textDocument.setUri(DUMMY_URI+".xml");
	changeEvent.setTextDocument(textDocument);
	TextDocumentContentChangeEvent contentChange = new TextDocumentContentChangeEvent("<to xmlns=\"http://camel.apache.org/schema/blueprint\" uri=\"\"></to>\n");
	changeEvent.setContentChanges(Collections.singletonList(contentChange));
	camelLanguageServer.getTextDocumentService().didChange(changeEvent);
	
	//check old position doesn't provide completion
	CompletableFuture<Either<List<CompletionItem>, CompletionList>> completionsAtOldPosition = getCompletionFor(camelLanguageServer, new Position(0, 11));
	assertThat(completionsAtOldPosition.get().getLeft()).isEmpty();
	
	//check new position provides completion
	CompletableFuture<Either<List<CompletionItem>, CompletionList>> completionsAtNewPosition = getCompletionFor(camelLanguageServer, new Position(0, 58));
	assertThat(completionsAtNewPosition.get().getLeft()).isNotEmpty();
	
}
 
Example #9
Source File: CamelDiagnosticTest.java    From camel-language-server with Apache License 2.0 5 votes vote down vote up
@Test
void testValidationErrorUpdatedOnChange() throws Exception {
	testDiagnostic("camel-with-endpoint-error", 1, ".xml");
	
	camelLanguageServer.getTextDocumentService().getOpenedDocument(DUMMY_URI+".xml").getText();
	DidChangeTextDocumentParams params = new DidChangeTextDocumentParams();
	params.setTextDocument(new VersionedTextDocumentIdentifier(DUMMY_URI+".xml", 2));
	List<TextDocumentContentChangeEvent> contentChanges = new ArrayList<>();
	contentChanges.add(new TextDocumentContentChangeEvent("<from uri=\"timer:timerName?delay=1000\" xmlns=\"http://camel.apache.org/schema/blueprint\"></from>\n"));
	params.setContentChanges(contentChanges);
	camelLanguageServer.getTextDocumentService().didChange(params);
	
	await().timeout(AWAIT_TIMEOUT).untilAsserted(() -> assertThat(lastPublishedDiagnostics.getDiagnostics()).isEmpty());
}
 
Example #10
Source File: SemanticHighlightingTest.java    From eclipse.jdt.ls with Eclipse Public License 2.0 5 votes vote down vote up
protected void changeDocument(ICompilationUnit unit, int version, TextDocumentContentChangeEvent event, TextDocumentContentChangeEvent... rest) {
	DidChangeTextDocumentParams changeParms = new DidChangeTextDocumentParams();
	VersionedTextDocumentIdentifier textDocument = new VersionedTextDocumentIdentifier();
	textDocument.setUri(JDTUtils.toURI(unit));
	textDocument.setVersion(version);
	changeParms.setTextDocument(textDocument);
	changeParms.setContentChanges(Lists.asList(event, rest));
	lifeCycleHandler.didChange(changeParms);
}
 
Example #11
Source File: BaseDocumentLifeCycleHandler.java    From eclipse.jdt.ls with Eclipse Public License 2.0 5 votes vote down vote up
public void didChange(DidChangeTextDocumentParams params) {
	ISchedulingRule rule = JDTUtils.getRule(params.getTextDocument().getUri());
	try {
		ResourcesPlugin.getWorkspace().run(new IWorkspaceRunnable() {
			@Override
			public void run(IProgressMonitor monitor) throws CoreException {
				handleChanged(params);
			}
		}, rule, IWorkspace.AVOID_UPDATE, new NullProgressMonitor());
	} catch (CoreException e) {
		JavaLanguageServerPlugin.logException("Handle document change ", e);
	}
}
 
Example #12
Source File: CompletionHandlerTest.java    From eclipse.jdt.ls with Eclipse Public License 2.0 5 votes vote down vote up
private void changeDocument(ICompilationUnit unit, String content, int version) throws JavaModelException {
	DidChangeTextDocumentParams changeParms = new DidChangeTextDocumentParams();
	VersionedTextDocumentIdentifier textDocument = new VersionedTextDocumentIdentifier();
	textDocument.setUri(JDTUtils.toURI(unit));
	textDocument.setVersion(version);
	changeParms.setTextDocument(textDocument);
	TextDocumentContentChangeEvent event = new TextDocumentContentChangeEvent();
	event.setText(content);
	List<TextDocumentContentChangeEvent> contentChanges = new ArrayList<>();
	contentChanges.add(event);
	changeParms.setContentChanges(contentChanges);
	lifeCycleHandler.didChange(changeParms);
}
 
Example #13
Source File: BasicDocument.java    From MSPaintIDE with MIT License 5 votes vote down vote up
public BasicDocument(ImageClass imageClass, LanguageServerWrapper lsWrapper) {
    this.file = imageClass.getInputImage();
    this.imageClass = imageClass;
    this.lsWrapper = lsWrapper;
    this.requestManager = lsWrapper.getRequestManager();
    this.hiddenClone = new File(file.getAbsolutePath().replaceAll("\\.png$", ""));

    this.text = imageClass.getText();

    this.changesParams = new DidChangeTextDocumentParams(new VersionedTextDocumentIdentifier(),
            Collections.singletonList(new TextDocumentContentChangeEvent()));

    changesParams.getTextDocument().setUri(getURI());
}
 
Example #14
Source File: TeiidDdlTextDocumentService.java    From syndesis with Apache License 2.0 5 votes vote down vote up
@Override
public void didChange(DidChangeTextDocumentParams params) {
    LOGGER.debug("didChange: {}", params.getTextDocument());
    List<TextDocumentContentChangeEvent> contentChanges = params.getContentChanges();
    TextDocumentItem textDocument = openedDocuments.get(params.getTextDocument().getUri());
    if (!contentChanges.isEmpty()) {
        textDocument.setText(contentChanges.get(0).getText());
        new DdlDiagnostics(this.teiidLanguageServer).publishDiagnostics(textDocument);
    }
}
 
Example #15
Source File: RdfLintLanguageServerTest.java    From rdflint with MIT License 5 votes vote down vote up
@Test
public void diagnosticsChangeParseError() throws Exception {
  RdfLintLanguageServer lsp = new RdfLintLanguageServer();
  InitializeParams initParams = new InitializeParams();
  String rootPath = this.getClass().getClassLoader().getResource("testValidatorsImpl/").getPath();
  String parentPath = rootPath + "TrimValidator/turtle_needtrim";
  initParams.setRootUri(RdfLintLanguageServer.convertFilePath2Uri(parentPath));
  lsp.initialize(initParams);

  LanguageClient client = mock(LanguageClient.class);
  lsp.connect(client);

  DidChangeTextDocumentParams changeParams = new DidChangeTextDocumentParams();
  changeParams.setTextDocument(new VersionedTextDocumentIdentifier());
  changeParams.getTextDocument()
      .setUri(RdfLintLanguageServer.convertFilePath2Uri(parentPath + "/needtrim.rdf"));
  List<TextDocumentContentChangeEvent> changeEvents = new LinkedList<>();
  changeParams.setContentChanges(changeEvents);
  changeEvents.add(new TextDocumentContentChangeEvent());
  changeEvents.get(0).setText("<rdf:RDF\n"
      + "    xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\"\n"
      + "    xmlns:schema=\"http://schema.org/\"\n"
      + "    >\n"
      + "\n"
      + "  <rdf:Description rdf:about=\"something\">\n"
      + "    <schema:familyName xml:lang=\"ja\">familyName</schema:familyN>\n"
      + "  </rdf:Description>\n"
      + "\n"
      + "</rdf:RDF>");
  lsp.didChange(changeParams);

  verify(client, times(1)).publishDiagnostics(any());
}
 
Example #16
Source File: RdfLintLanguageServerTest.java    From rdflint with MIT License 5 votes vote down vote up
@Test
public void diagnosticsChange() throws Exception {
  RdfLintLanguageServer lsp = new RdfLintLanguageServer();
  InitializeParams initParams = new InitializeParams();
  String rootPath = this.getClass().getClassLoader().getResource("testValidatorsImpl/").getPath();
  String parentPath = rootPath + "TrimValidator/turtle_needtrim";
  initParams.setRootUri(RdfLintLanguageServer.convertFilePath2Uri(parentPath));
  lsp.initialize(initParams);

  LanguageClient client = mock(LanguageClient.class);
  lsp.connect(client);

  DidChangeTextDocumentParams changeParams = new DidChangeTextDocumentParams();
  changeParams.setTextDocument(new VersionedTextDocumentIdentifier());
  changeParams.getTextDocument()
      .setUri(RdfLintLanguageServer.convertFilePath2Uri(parentPath + "/needtrim.rdf"));
  List<TextDocumentContentChangeEvent> changeEvents = new LinkedList<>();
  changeParams.setContentChanges(changeEvents);
  changeEvents.add(new TextDocumentContentChangeEvent());
  changeEvents.get(0).setText("<rdf:RDF\n"
      + "    xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\"\n"
      + "    xmlns:schema=\"http://schema.org/\"\n"
      + "    >\n"
      + "\n"
      + "  <rdf:Description rdf:about=\"something\">\n"
      + "    <schema:familyName xml:lang=\"ja\">familyName </schema:familyName>\n"
      + "  </rdf:Description>\n"
      + "\n"
      + "</rdf:RDF>");
  lsp.didChange(changeParams);

  verify(client, times(1)).publishDiagnostics(any());
}
 
Example #17
Source File: RdfLintLanguageServer.java    From rdflint with MIT License 5 votes vote down vote up
@Override
public void didChange(DidChangeTextDocumentParams params) {
  // get source
  int size = params.getContentChanges().size();
  String sourceText = params.getContentChanges().get(size - 1).getText();
  sourceTextMap.put(params.getTextDocument().getUri(), sourceText);

  // diagnostics
  diagnostics(params.getTextDocument().getUri());
}
 
Example #18
Source File: CamelTextDocumentService.java    From camel-language-server with Apache License 2.0 5 votes vote down vote up
@Override
public void didChange(DidChangeTextDocumentParams params) {
	LOGGER.info("didChange: {}", params.getTextDocument());
	List<TextDocumentContentChangeEvent> contentChanges = params.getContentChanges();
	TextDocumentItem textDocumentItem = openedDocuments.get(params.getTextDocument().getUri());
	if (!contentChanges.isEmpty()) {
		textDocumentItem.setText(contentChanges.get(0).getText());
		new DiagnosticRunner(getCamelCatalog(), camelLanguageServer).compute(params);
	}
}
 
Example #19
Source File: TextDocuments.java    From lemminx with Eclipse Public License 2.0 5 votes vote down vote up
public T onDidChangeTextDocument(DidChangeTextDocumentParams params) {
	synchronized (documents) {
		T document = getDocument(params.getTextDocument());
		if (document != null) {
			document.setVersion(params.getTextDocument().getVersion());
			document.update(params.getContentChanges());
			return document;
		}
	}
	return null;
}
 
Example #20
Source File: DocumentContentSynchronizer.java    From intellij-quarkus with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Convert IntelliJ {@link DocumentEvent} to LS according {@link TextDocumentSyncKind}.
 *
 * @param event
 *            IntelliJ {@link DocumentEvent}
 * @return true if change event is ready to be sent
 */
private boolean createChangeEvent(DocumentEvent event) {
    changeParams = new DidChangeTextDocumentParams(new VersionedTextDocumentIdentifier(), Collections.singletonList(new TextDocumentContentChangeEvent()));
    changeParams.getTextDocument().setUri(fileUri.toString());

    Document document = event.getDocument();
    TextDocumentContentChangeEvent changeEvent = null;
    TextDocumentSyncKind syncKind = getTextDocumentSyncKind();
    switch (syncKind) {
        case None:
            return false;
        case Full:
            changeParams.getContentChanges().get(0).setText(event.getDocument().getText());
            break;
        case Incremental:
            changeEvent = changeParams.getContentChanges().get(0);
            CharSequence newText = event.getNewFragment();
            int offset = event.getOffset();
            int length = event.getOldLength();
            try {
                // try to convert the Eclipse start/end offset to LS range.
                Range range = new Range(LSPIJUtils.toPosition(offset, document),
                        LSPIJUtils.toPosition(offset + length, document));
                changeEvent.setRange(range);
                changeEvent.setText(newText.toString());
                changeEvent.setRangeLength(length);
            } finally {
            }
            break;
    }
    return true;
}
 
Example #21
Source File: FileContentsTrackerTests.java    From groovy-language-server with Apache License 2.0 5 votes vote down vote up
@Test
void testDidChangeWithRangeMultiline() {
	DidOpenTextDocumentParams openParams = new DidOpenTextDocumentParams();
	openParams.setTextDocument(new TextDocumentItem("file.txt", "plaintext", 1, "hello\nworld"));
	tracker.didOpen(openParams);
	DidChangeTextDocumentParams changeParams = new DidChangeTextDocumentParams();
	changeParams.setTextDocument(new VersionedTextDocumentIdentifier("file.txt", 2));
	TextDocumentContentChangeEvent changeEvent = new TextDocumentContentChangeEvent();
	changeEvent.setText("affles");
	changeEvent.setRange(new Range(new Position(1, 1), new Position(1, 5)));
	changeEvent.setRangeLength(4);
	changeParams.setContentChanges(Collections.singletonList(changeEvent));
	tracker.didChange(changeParams);
	Assertions.assertEquals("hello\nwaffles", tracker.getContents(URI.create("file.txt")));
}
 
Example #22
Source File: FileContentsTrackerTests.java    From groovy-language-server with Apache License 2.0 5 votes vote down vote up
@Test
void testDidChangeWithRange() {
	DidOpenTextDocumentParams openParams = new DidOpenTextDocumentParams();
	openParams.setTextDocument(new TextDocumentItem("file.txt", "plaintext", 1, "hello world"));
	tracker.didOpen(openParams);
	DidChangeTextDocumentParams changeParams = new DidChangeTextDocumentParams();
	changeParams.setTextDocument(new VersionedTextDocumentIdentifier("file.txt", 2));
	TextDocumentContentChangeEvent changeEvent = new TextDocumentContentChangeEvent();
	changeEvent.setText(", friend");
	changeEvent.setRange(new Range(new Position(0, 5), new Position(0, 11)));
	changeEvent.setRangeLength(6);
	changeParams.setContentChanges(Collections.singletonList(changeEvent));
	tracker.didChange(changeParams);
	Assertions.assertEquals("hello, friend", tracker.getContents(URI.create("file.txt")));
}
 
Example #23
Source File: FileContentsTrackerTests.java    From groovy-language-server with Apache License 2.0 5 votes vote down vote up
@Test
void testDidChangeWithoutRange() {
	DidOpenTextDocumentParams openParams = new DidOpenTextDocumentParams();
	openParams.setTextDocument(new TextDocumentItem("file.txt", "plaintext", 1, "hello world"));
	tracker.didOpen(openParams);
	DidChangeTextDocumentParams changeParams = new DidChangeTextDocumentParams();
	changeParams.setTextDocument(new VersionedTextDocumentIdentifier("file.txt", 2));
	TextDocumentContentChangeEvent changeEvent = new TextDocumentContentChangeEvent();
	changeEvent.setText("hi there");
	changeParams.setContentChanges(Collections.singletonList(changeEvent));
	tracker.didChange(changeParams);
	Assertions.assertEquals("hi there", tracker.getContents(URI.create("file.txt")));
}
 
Example #24
Source File: EditorEventManager.java    From lsp4intellij with Apache License 2.0 5 votes vote down vote up
public EditorEventManager(Editor editor, DocumentListener documentListener, EditorMouseListener mouseListener,
                          EditorMouseMotionListener mouseMotionListener, LSPCaretListenerImpl caretListener,
                          RequestManager requestManager, ServerOptions serverOptions, LanguageServerWrapper wrapper) {

    this.editor = editor;
    this.documentListener = documentListener;
    this.mouseListener = mouseListener;
    this.mouseMotionListener = mouseMotionListener;
    this.requestManager = requestManager;
    this.wrapper = wrapper;
    this.caretListener = caretListener;

    this.identifier = new TextDocumentIdentifier(FileUtils.editorToURIString(editor));
    this.changesParams = new DidChangeTextDocumentParams(new VersionedTextDocumentIdentifier(),
            Collections.singletonList(new TextDocumentContentChangeEvent()));
    this.syncKind = serverOptions.syncKind;

    this.completionTriggers = (serverOptions.completionOptions != null
            && serverOptions.completionOptions.getTriggerCharacters() != null) ?
            serverOptions.completionOptions.getTriggerCharacters() :
            new ArrayList<>();

    this.signatureTriggers = (serverOptions.signatureHelpOptions != null
            && serverOptions.signatureHelpOptions.getTriggerCharacters() != null) ?
            serverOptions.signatureHelpOptions.getTriggerCharacters() :
            new ArrayList<>();

    this.project = editor.getProject();

    EditorEventManagerBase.uriToManager.put(FileUtils.editorToURIString(editor), this);
    EditorEventManagerBase.editorToManager.put(editor, this);
    changesParams.getTextDocument().setUri(identifier.getUri());

    this.currentHint = null;
}
 
Example #25
Source File: DocumentServiceStub.java    From saros with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void didChange(DidChangeTextDocumentParams params) {
  System.out.println("didChange");
}
 
Example #26
Source File: LanguageServerImpl.java    From xtext-core with Eclipse Public License 2.0 4 votes vote down vote up
@Override
public void didChange(DidChangeTextDocumentParams params) {
	runBuildable(() -> toBuildable(params));
}
 
Example #27
Source File: LanguageServerImpl.java    From xtext-core with Eclipse Public License 2.0 4 votes vote down vote up
/**
 * Evaluate the params and deduce the respective build command.
 */
protected Buildable toBuildable(DidChangeTextDocumentParams params) {
	VersionedTextDocumentIdentifier textDocument = params.getTextDocument();
	return workspaceManager.didChangeTextDocumentContent(getURI(textDocument), textDocument.getVersion(),
			params.getContentChanges());
}
 
Example #28
Source File: MockLanguageServer.java    From lsp4j with Eclipse Public License 2.0 4 votes vote down vote up
@Override
public void didChange(DidChangeTextDocumentParams params) {
}
 
Example #29
Source File: SyntaxLanguageServer.java    From eclipse.jdt.ls with Eclipse Public License 2.0 4 votes vote down vote up
@Override
public void didChange(DidChangeTextDocumentParams params) {
	logInfo(">> document/didChange");
	documentLifeCycleHandler.didChange(params);
}
 
Example #30
Source File: JDTLanguageServer.java    From eclipse.jdt.ls with Eclipse Public License 2.0 4 votes vote down vote up
@Override
public void didChange(DidChangeTextDocumentParams params) {
	logInfo(">> document/didChange");
	documentLifeCycleHandler.didChange(params);
}