vscode
vscode copied to clipboard
TM_FILENAME_BASE generates the old filename ( just for uppercase and lowercase changes)
Does this issue occur when all extensions are disabled?: Yes
- VS Code Version: 1.71.2
- OS Version: Windows 11 Pro 21H2 22000.978
Steps to Reproduce:
- Create a user snippet for JS file ( i tested just with js files ) and use TM_FILENAME_BASE variable in it .
- Create a new js file and start editing that file ( just write some lines of code )
- Rename the js file ( just change the uppercase or lowercase of the old name, for e.g. change reactcomponent.js to Reactcomponent.js )
- Now use that snippet in the file, the old name has been generated instead of the new name.
this occurs just for changing uppercase or lowercase in the file name. if you change the name into a new one ( for e.g. just add a letter) the new name will be generated successfully ,
this occurs just for changing uppercase or lowercase in the file name.
On windows and mac (which default to being case-insensitive) we don't treat this as a "true" rename, eg the associated uris don't change but it is merely a label change. That new label isn't propagated into all areas
@bpasero Is there a way to get the UI path, esp. given this happens in the editor/monaco-layer. Also, I am using the label service so kinda surprised that this doesn't Just Work ™️
@jrieken not on the editor layer so far, what we typically end up doing in the workbench is ask the editor for its preferred resource:
https://github.com/microsoft/vscode/blob/7af646716e9889ec1736e231cf3f3f037f5b2dbd/src/vs/workbench/common/editor.ts#L784-L788
It is then being used by the EditorResourceAccessor utility by calling getOriginalUri:
https://github.com/microsoft/vscode/blob/7af646716e9889ec1736e231cf3f3f037f5b2dbd/src/vs/workbench/common/editor.ts#L1152-L1168
Where is your code for using the label service?
Where is your code for using the label service?
This is where I use it https://github.com/microsoft/vscode/blob/86127c6cce7f27b71b8b112d0c59cc6ab6d5f4ad/src/vs/editor/contrib/snippet/browser/snippetVariables.ts#L185
Yeah, and that is the canonical URI of the model. The label service is not aware of the original URI, lets discuss.
@sajadko This issue is acknowledged but nevertheless I am going to close it as wont-fix. This is because the fix-costs are quite high. When using a case-insensitive file system all casings are correct (in the terms of resolving to the correct file) and the knowledge what "label path" is currently preferred isn't available to the snippets feature layer.