VSCode: typescript/intellisense not responding to an auto-generated files

1k views Asked by At

I have a problem with vscode: if a file is changed externally (not by a vscode), intellisense/typechecking is not responding immediately to a change. Sometimes it works after few seconds, sometimes not - I need to open changed file in vscode or run Restart extension host).

I'm generating some files with a node script, and occasionally new version causes type errors, that shows immediately in webpack but not in vscode.

Is there a way to, I don't know, clear some cache, restart extension host via node.js script or somehow broadcast information about changed files?

// EDIT: OK, So I've found out about https://www.typescriptlang.org/docs/handbook/configuring-watch.html

    "typescript.tsserver.watchOptions": {
        // Use native file system events for files and directories
        "watchFile": "useFsEvents",
        "watchDirectory": "useFsEvents",
    }

Now it works much faster (on windows) but, according to a node.js doc:

Caveats

The fs.watch API is not 100% consistent across platforms, and is unavailable in some situations.

The recursive option is only supported on macOS and Windows. An ERR_FEATURE_UNAVAILABLE_ON_PLATFORM exception will be thrown when the option is used on a platform that does not support it.

On Windows, no events will be emitted if the watched directory is moved or renamed. An EPERM error is reported when the watched directory is deleted.

Sooo.. yeah.

0

There are 0 answers