org.eclipse.lsp4j.DidOpenTextDocumentParams#getTextDocument ( )源码实例Demo

下面列出了org.eclipse.lsp4j.DidOpenTextDocumentParams#getTextDocument ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: lemminx   文件: TextDocuments.java
public T onDidOpenTextDocument(DidOpenTextDocumentParams params) {
	TextDocumentItem item = params.getTextDocument();
	synchronized (documents) {
		T document = createDocument(item);
		documents.put(document.getUri(), document);
		return document;
	}
}
 
@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);
}
 
源代码3 项目: syndesis   文件: TeiidDdlTextDocumentService.java
@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);
}
 
源代码4 项目: n4js   文件: XLanguageServerImpl.java
@Override
public void didOpen(DidOpenTextDocumentParams params) {
	TextDocumentItem textDocument = params.getTextDocument();
	openFilesManager.openFile(getURI(textDocument), textDocument.getVersion(), textDocument.getText());
}
 
源代码5 项目: vscode-as3mxml   文件: ActionScriptServices.java
/**
 * 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);
}
 
源代码6 项目: xtext-core   文件: LanguageServerImpl.java
/**
 * 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());
}