Java Code Examples for org.eclipse.lsp4j.DidOpenTextDocumentParams#getTextDocument()
The following examples show how to use
org.eclipse.lsp4j.DidOpenTextDocumentParams#getTextDocument() .
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: TextDocuments.java From lemminx with Eclipse Public License 2.0 | 5 votes |
public T onDidOpenTextDocument(DidOpenTextDocumentParams params) { TextDocumentItem item = params.getTextDocument(); synchronized (documents) { T document = createDocument(item); documents.put(document.getUri(), document); return document; } }
Example 2
Source File: CamelTextDocumentService.java From camel-language-server with Apache License 2.0 | 5 votes |
@Override public void didOpen(DidOpenTextDocumentParams params) { TextDocumentItem textDocument = params.getTextDocument(); LOGGER.info("didOpen: {}", textDocument); openedDocuments.put(textDocument.getUri(), textDocument); new DiagnosticRunner(getCamelCatalog(), camelLanguageServer).compute(params); }
Example 3
Source File: TeiidDdlTextDocumentService.java From syndesis with Apache License 2.0 | 5 votes |
@Override public void didOpen(DidOpenTextDocumentParams params) { TextDocumentItem textDocument = params.getTextDocument(); LOGGER.debug("didOpen: {}", textDocument); openedDocuments.put(textDocument.getUri(), textDocument); new DdlDiagnostics(this.teiidLanguageServer).publishDiagnostics(textDocument); }
Example 4
Source File: XLanguageServerImpl.java From n4js with Eclipse Public License 1.0 | 4 votes |
@Override public void didOpen(DidOpenTextDocumentParams params) { TextDocumentItem textDocument = params.getTextDocument(); openFilesManager.openFile(getURI(textDocument), textDocument.getVersion(), textDocument.getText()); }
Example 5
Source File: ActionScriptServices.java From vscode-as3mxml with Apache License 2.0 | 4 votes |
/** * Called whan a file is opened for editing in Visual Studio Code. We store * the file's contents in a String since any changes that have been made to * it may not have been saved yet. This method will not be called again if * the user simply switches to a different tab for another file and then * switched back to this one, without every closing it completely. In * other words, the language server does not usually know which file is * currently visible to the user in VSCode. */ @Override public void didOpen(DidOpenTextDocumentParams params) { TextDocumentItem 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; } //even if it's not in a workspace folder right now, store it just in //case we need it later. //example: if we modify to source-path compiler option String text = textDocument.getText(); fileTracker.openFile(path, text); WorkspaceFolderData folderData = workspaceFolderManager.getWorkspaceFolderDataForSourceFile(path); if (folderData == null) { return; } if (fallbackConfig != null && folderData.equals(workspaceFolderManager.getFallbackFolderData())) { fallbackConfig.didOpen(path); } getProject(folderData); ILspProject project = folderData.project; if (project == null) { //something went wrong while creating the project return; } //notify the workspace that it should read the file from memory //instead of loading from the file system String normalizedPath = FilenameNormalization.normalize(path.toAbsolutePath().toString()); IFileSpecification fileSpec = fileTracker.getFileSpecification(normalizedPath); compilerWorkspace.fileChanged(fileSpec); //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 6
Source File: LanguageServerImpl.java From xtext-core with Eclipse Public License 2.0 | 4 votes |
/** * Evaluate the params and deduce the respective build command. * @since 2.20 */ protected Buildable toBuildable(DidOpenTextDocumentParams params) { TextDocumentItem textDocument = params.getTextDocument(); return workspaceManager.didOpen(getURI(textDocument), textDocument.getVersion(), textDocument.getText()); }