microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
164.26k stars 29.3k forks source link

Case insensitive update not reflected in vscode.window.activeTextEditor.document.uri.fsPath #211970

Closed goto-dev-null closed 6 months ago

goto-dev-null commented 6 months ago

Type: Bug

If a file is renamed from "Foobar.ts" to "FooBar.ts", the value contained in vscode.window.activeTextEditor.document.uri.fsPath will still be "Foobar.ts". This continues to occur even if you rename the file to something totally diferent then rename it back, and also occurs when closing out all tabs and fully exiting VS Code. I would expect this to be updated to reflect the actual case of the file.

I apologize for not having a non-extension related way of reproducing. I will try to walk through why I believe this is in VS Code and not an extension.

The extension in question is DX-Code-Companion. Jt sends a command to the terminal for the active editor file. Here is the function that seeks to get the active path. It uses vscode.window.activeTextEditor.document.uri.fsPath.

https://github.com/msrivastav13/DX-Code-Companion/blob/f08e1f12fa079ef6864f13ede4c27887e24ab0ff/src/services/vscodeCore.ts#L33-L42

For extra context if needed, here's the code that invokes the above; it's pretty basic in that it just wants the filepath back: https://github.com/msrivastav13/DX-Code-Companion/blob/f08e1f12fa079ef6864f13ede4c27887e24ab0ff/src/services/deploy.ts#L87-L97

VS Code version: Code 1.88.1 (e170252f762678dec6ca2cc69aba1570769a5d39, 2024-04-10T17:41:02.734Z) OS version: Windows_NT x64 10.0.22000 Modes:

System Info |Item|Value| |---|---| |CPUs|Intel(R) Core(TM) i7-8565U CPU @ 1.80GHz (8 x 1992)| |GPU Status|2d_canvas: enabled
canvas_oop_rasterization: enabled_on
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled| |Load (avg)|undefined| |Memory (System)|15.75GB (1.21GB free)| |Process Argv|--crash-reporter-id b5117523-179c-4674-abe0-7cfb8463b007| |Screen Reader|no| |VM|0%|
Extensions (70) Extension|Author (truncated)|Version ---|---|--- better-comments|aar|3.0.2 numbered-bookmarks|ale|8.4.0 mermaid-markdown-syntax-highlighting|bpr|1.6.3 json-tree-view|Cha|2.6.0 vscode-modelines|chr|2.0.6 apex-pmd|chu|0.7.0 coddx-alpha|cod|0.3.1 vscode-eslint|dba|2.4.4 vscode-deno|den|3.37.0 githistory|don|0.6.20 filter-lines|ear|1.1.0 EditorConfig|Edi|0.16.4 RunOnSave|eme|0.2.0 prettier-vscode|esb|10.4.0 vscode-diff|fab|2.1.2 vscode-highlight|fab|1.9.0 url-encode|fle|1.1.0 copilot|Git|1.186.0 copilot-chat|Git|0.14.1 copilot-labs|Git|0.17.1121 vscode-pull-request-github|Git|0.86.1 setting-toggle|Ho-|1.6.0 nsis|idl|4.4.0 custom-local-formatters|jki|0.0.6 vscode-graphviz|joa|0.0.9 git-time|jod|1.0.4 git-graph|mhu|1.30.0 dx-code-companion|Moh|0.4.9 azure-pipelines|ms-|1.228.0 vscode-azurefunctions|ms-|1.14.3 vscode-azureresourcegroups|ms-|0.8.6 vscode-bicep|ms-|0.26.170 vscode-dotnet-runtime|ms-|2.0.3 remote-ssh|ms-|0.110.1 remote-ssh-edit|ms-|0.86.0 azure-account|ms-|0.11.7 live-server|ms-|0.4.13 powershell|ms-|2024.2.1 remote-explorer|ms-|0.4.3 vscode-speech|ms-|0.8.0 vsliveshare|ms-|1.0.5918 title|nil|0.1.0 run-on-save|puc|1.8.0 vscode-xml|red|0.26.1 vscode-yaml|red|1.14.0 vscode-coverage-gutters|rya|2.11.1 salesforce-vscode-slds|sal|1.4.8 salesforcedx-vscode|sal|60.11.0 salesforcedx-vscode-apex|sal|60.11.0 salesforcedx-vscode-core|sal|60.11.0 salesforcedx-vscode-expanded|sal|60.11.0 salesforcedx-vscode-lwc|sal|60.11.0 salesforcedx-vscode-soql|sal|60.11.0 sfdx-code-analyzer-vscode|sal|0.5.0 preview-vscode|sea|2.3.6 git-merger|sha|0.4.1 vscode-fileutils|sle|3.10.3 git-prefix|srm|1.3.2 code-spell-checker|str|3.0.1 even-better-toml|tam|0.19.2 sfflowvisualiser|Tod|0.2.2 vscode-mermaid-editor|tom|0.19.1 org-mode|too|0.5.0 sort-lines|Tyr|1.11.0 sfdx-command-builder|Vig|3.0.0 intellicode-api-usage-examples|Vis|0.2.8 vscode-mermaid-preview|vst|1.6.3 prettify-selected-json|vth|1.0.3 volar|Vue|2.0.10 change-case|wma|1.0.0 (1 theme extensions excluded)
A/B Experiments ``` vsliv368:30146709 vspor879:30202332 vspor708:30202333 vspor363:30204092 vscod805cf:30301675 binariesv615:30325510 vsaa593:30376534 py29gd2263:31024239 c4g48928:30535728 azure-dev_surveyone:30548225 962ge761:30959799 pythongtdpath:30769146 welcomedialog:30910333 pythonidxpt:30866567 pythonnoceb:30805159 asynctok:30898717 pythontestfixt:30902429 pythonregdiag2:30936856 pyreplss1:30897532 pythonmypyd1:30879173 pythoncet0:30885854 h48ei257:31000450 pythontbext0:30879054 accentitlementst:30995554 dsvsc016:30899300 dsvsc017:30899301 dsvsc018:30899302 cppperfnew:31000557 ccp2r3:30993541 dsvsc020:30976470 pythonait:31006305 dsvsc021:30996838 g316j359:31013175 pythoncenvpt:31022790 dwnewjupytercf:31035177 ```
vscodenpa commented 6 months ago

Thanks for creating this issue! It looks like you may be using an old version of VS Code, the latest stable release is 1.89.0. Please try upgrading to the latest version and checking whether this issue remains.

Happy Coding!

goto-dev-null commented 6 months ago

Nevermind, this might just be a windows case-insensitive issue. The tab reflected "FooBar.ts" even though on the filesystem it was still "Foobar.ts".