You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Provide a way to determine whether a SourceFile is an untitled, inexistent file #37987
Currently I'm trying to write a language service for typescript and I find myself unable to determine whether a file is untitled.
What I've noticed so far is that untitled files send untitled:^Untitled-1 as its filename to the getSymanticDiagnostics function. This naming convention could change anytime and also it's not consistently containing an URI or a filepath.
Is there some way to check whether a SourceFile is untitled?
Use Cases
I'm passing the files to a linter. If the file is untitled I'll get an incorrect results if I pass the filename which, at runtime, equals untitled:^Untitled-1.
We do not have any concept of untitiled files in program as it doesnt need to know but tsserver has isDynamicFileName that handles this to check if file needs to be checked on disk. In general any open file in editor may not exist on the disk since editor provides contents for the same.
Thanks for the rapid answer
I do not know whether this might be related to the @internal-tag but when I tried to look fot this method I found myself unable to find it
Activity
RyanCavanaugh commentedon Apr 20, 2020
Sheetal Nandi (@sheetalkamat) is this a guaranteed format?
sheetalkamat commentedon Apr 20, 2020
We do not have any concept of untitiled files in program as it doesnt need to know but tsserver has isDynamicFileName that handles this to check if file needs to be checked on disk. In general any open file in editor may not exist on the disk since editor provides contents for the same.
neurolag commentedon Apr 20, 2020
Thanks for the rapid answer
I do not know whether this might be related to the
@internal-tag but when I tried to look fot this method I found myself unable to find itsheetalkamat commentedon Apr 29, 2020
It is marked as internal. I dont see issue with making it public. PR is welcome to remove internal.
Make isDynamicFileName available publicly (#38269)