Always access to the file-path of the text editor #138523
Labels
editor-api
Issues about the API of vscode in the area of editors
feature-request
Request for new features or functionality
Milestone
I'm creating a VSCode Notebook extension. The notebook is about parsing Liquid (a templating language). Besides the liquid template fragments you type in code blocks it can also use the users data-files and Liquid templates on disk. That's all handled by a parser I include in the extension. To have a configuration per notebook, I've added a 'Settings' language to my notebook where you can do something like:
The provided paths can be absolute, but also relative. My idea is that relative paths are resolved from the location of the notebook in the editor. Currently the way to get the file-path of the open text editor in code is through this piece of code:
The problem is that if the file gets larger than 50 MB,
activeTextEditor
returnsundefined
(because of memory saving. See #32118). I understand that this is done for the contents of the file, but now it's a bit weird behavior now when theactiveTextEditor
is set orundefined
. I have a notebook currently 8 KB in size (so, very small) and in one run of the codeactiveTextEditor
is set, a few milliseconds later it's undefined.Request: I would like to have a standard way to obtain the path of the file in the text editor at all times, even if it's larger then 50MB.
The text was updated successfully, but these errors were encountered: