Closed MinusGix closed 3 years ago
Note: I realized that vscode.workspace.openTextDocument
probably keeps the file open so it is not a full disk read every time.
Still, caching the parsing result would be useful, especially if/when more complex checks/transformations need to be applied to the information.
Agreed! Adds in TODO The the 'list' changes very less, so this would be a lot better.
Since #13 was merged... Closing this.
The
macroList
function currently does not cache the files.Since it is called by
collect
(which is called by SugarCubediagnostics
andhover
), it can be called pretty often. While not often enough to likely cause notable/visible input lag it is still reads the file and parses it quite often.Solution: Use https://code.visualstudio.com/api/references/vscode-api#workspace.createFileSystemWatcher with the current glob for json/yaml/yml files, and keep a global variable (exported or not? I'd say no) of the last parsed result. Then
macroList
simple checks if it already exists. On a file edit/creation/deletion, all it has to do is perform the parsing again.I can implement this.