Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
322 views
in Technique[技术] by (71.8m points)

visual studio code - VSCode extension: send watched files to language server on activation

I'm trying to create a simple client + language server extension for Visual Studio Code (based on this guide) that would analyze the XML files and provide some diagnostic information based on .properties file contained within the workspace.

In package.json I defined the activation event:

"activationEvents": [
    "onLanguage:xml"
],

Client configuration:

// Options to control the language client
let clientOptions: LanguageClientOptions = {
    // Register the server for plain text documents
    documentSelector: [{
        scheme: "file",
        language: "xml"
    }],
    synchronize: {
        fileEvents: workspace.createFileSystemWatcher("**/*.properties")
    }
};

Server has registered onDidChangeWatchedFiles event handler and it is working fine when creating/editing/deleting the .properties files. However those files are not being sent to the server if user doesn't touch them at all.

My question is - what is correct way to send them to the server? Is there any VSCode API to trigger the create/change event during watcher registration? Should I sent a special request from the server to the client to fetch them?

question from:https://stackoverflow.com/questions/65952516/vscode-extension-send-watched-files-to-language-server-on-activation

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...