VSCode extension activation event onCreate file - visual-studio-code

I'm looking for create a extension on vscode but I want to trigger it when someone create a new file. I read the documentation but I find nothing on OnCreate activation event. Somebody know if it's possible to trigger this event ? Or why VSCode don't allow to trigger this event ?
Thanks in advance for the response ;)

As of VS Code 1.29, there is no generic fileCreated activation event. Please file a feature request if this is something you want to see
If you are only interested in files of a specific language, use the onLanguage: activation event. This will be fired when a new file is created of a given language.
Otherwise, you can activate on *. If you do this, try to defer any extensive operations until they are really needed since your extension will always be activated

There are events on the workspace object that one can listen to: onWillCreateFiles and onDidCreateFiles

Related

the vscode python extension has many activation events. But I don't want to use some of them, so what should I do to ban thes auto executed functions

"""
the vscode python extension has many activation events. But I don't want to use some of them, so
what should I do to ban thes auto executed functions ?
"""
[1]: https://i.stack.imgur.com/I55R5.png
Those are optional setting that would “auto execute,” if you enabled them.
If you would like to see if you have any turned on, check your settings and search for any of the offending save actions

Drag and Drop Behavior on Chrome DevTools Protocol

I am trying to write a tool that open's a website and interacts with and triggers the drag/drop behavior. I am seeing Input.dragIntercepted, Input.dispatchDragEvent functions in the documentation. But when I use these functions, I am getting a ... is not a function error. Probably, I am not using them in a proper way.
How can I use these functions to trigger drag and drop behavior of the web application? I did not find any example that shows usage of these functions.
First of all, Input.dragIntercepted really isn't a function. It's an event that will be fired, but only if you enable it, using Input.setInterceptDrags with enable set as true.
This is documented both here and here.

How to count LanguageServer completion requests that have occurred from within a VSCode extension?

We have a request to count the number of 'completion' events that have occurred from our LanguageServer in the vscode-python extension. (After a number of these completion events, we want to raise a popup and ask the user for some feedback).
I've not found a way to do this without asking for a change from the LanguageServer itself (have it raise an event that I can hook into). I am wondering if there is such a facility already available though, within VSCode?
I have found the BaseLanguageClient.onNotification from within the vscode-languageclient library. I am not entirely sure what method to hook into with this though, or even if there is an event relevant to my need.
Anyone have any tips for this?
You can inject middleware into your LanguageClient in order to capture events such as these. See here for an example:
https://github.com/Microsoft/vscode-go/blob/e0f8fc2540fecfe964807b97b1e4276c6b6c7a21/src/goMain.ts#L113

How do I detect a change to the language in a document in Visual Studio Code

There are a number of events for detecting when a document is focused window.onDidChangeActiveTextEditor or when a document's content or metadata is changed (e.g. workspace.onDidChangeTextDocument), but is there any way to detect when the syntax language of a file has changed?
The property is available under window.activeTextEditor.document.languageId, but I can't seem to find a way to detect when this value changes.
The VSCode API Documentation describes the setLanguageConfiguration function which indirectly provides the answer:
Note that calling this function will trigger the onDidCloseTextDocument event followed by the onDidOpenTextDocument event.
Registering handlers for these events confirmed that they do indeed fire when the languageId changes.

jQuery File Upload's change callback returns nothing

Everything about the uploader is working perfectly, but one callback seems to do nothing:
.bind('fileuploadchange', function (e, data) {
console.log("foo");
})
Binding to the change event never returns anything... so my question:
1) Is this a bug? I'm using the most recent version.
2) Is there another/better way to detect when files are manually removed from the upload queue (something more elegant than reading DOM elements)?
There might be a bit of misunderstanding in what the fileuploadchange event does.
The admittedly limited documentation for the change event states:
Callback for change events of the fileInput collection.
That means it's an event callback for the native change event of all the file input elements of the fileupload widget.
This event only fires if the user selects one or more files via the file picker dialog that is displayed after clicking on the file input button.
Technically, the basic fileupload library doesn't keep track of a queue.
It's up to the UI implementation to handle this, via the various callbacks provided by the basic library.
Until the user actually starts the file upload, there is technically nothing the basic library could keep track of.
And as soon as a file upload is started, the done and fail events are your basic building blocks.
By the way, the sample UI implementation handles the removal of items that have not been started yet by triggering a manual fail event.