jest-community / vscode-jest

The optimal flow for Jest based testing in VS Code
MIT License
2.82k stars 290 forks source link

Gutter icons go missing after changing file's capitalization with it open #810

Open phoenixeliot opened 2 years ago

phoenixeliot commented 2 years ago

Environment

  1. vscode-jest version: 4.2.1

  2. node -v: v14.17.5

  3. npm -v or yarn --version: yarn 1.22.5

  4. npm ls jest or npm ls react-scripts (if you haven’t ejected): jest@27.4.4

  5. your vscode-jest settings if customized:

    "jest.autoRun": { "watch": true, "onStartup": ["all-tests"] }, // "onSave": "test-file",
    "jest.testExplorer": {
    "showInlineError": true,
    "enabled": true
    },

    But this occurs even without these settings.

  6. Operating system: macOS 11.6.1

Prerequisite

Steps to Reproduce

  1. Clone this repo at this commit: https://github.com/phoenixeliot/line-puzzle/commit/fa953e9010a0e8998643fb2a0c3a59d7f36fde1c
  2. Run yarn in the repo folder
  3. Open the folder in VS Code
  4. Open Cell.test.js
  5. Keeping the file open, rename it to cell.test.js (lowercase)
  6. In the test in that file, change color: "O", to color: "Y", to make it fail
  7. Observe the red underline from the test failure, but no gutter markings
  8. Rename the file to Cell.test.js and save it
  9. Observe the gutter markings return

Relevant Debug Info

This relates to a piece of VS Code editor state that is saved in the SQLite database at ~/Library/ApplicationSupport/Code/User/<session ID>/state.vscdb, under the key memento/workbench.parts.editor.

When this error is occurring, the JSON at that row looks like this (in this case, it's visible with the Board.test.ts file, which is how I originally got this problem. The same pattern is visible in the entry for board.ts). In particular, note the "resourceJSON" which contains the old capitalization, and "preferredResourceJSON" which has the new capitalization. In this case I had started lowercase and changed it to uppercase.

memento/workbench.parts.editor ``` { "editorpart.state": { "serializedGrid": { "root": { "type": "branch", "data": [ { "type": "leaf", "data": { "id": 3, "editors": [ { "id": "workbench.editors.files.fileEditorInput", "value": "{\"resourceJSON\":{\"$mid\":1,\"fsPath\":\"/Users/phoenix/Code/_personal_projects/line-puzzle/src/board.ts\",\"external\":\"file:///Users/phoenix/Code/_personal_projects/line-puzzle/src/board.ts\",\"path\":\"/Users/phoenix/Code/_personal_projects/line-puzzle/src/board.ts\",\"scheme\":\"file\"},\"preferredResourceJSON\":{\"$mid\":1,\"fsPath\":\"/Users/phoenix/Code/_personal_projects/line-puzzle/src/Board.ts\",\"external\":\"file:///Users/phoenix/Code/_personal_projects/line-puzzle/src/Board.ts\",\"path\":\"/Users/phoenix/Code/_personal_projects/line-puzzle/src/Board.ts\",\"scheme\":\"file\"},\"encoding\":\"utf8\"}" }, { "id": "workbench.editors.files.fileEditorInput", "value": "{\"resourceJSON\":{\"$mid\":1,\"fsPath\":\"/Users/phoenix/Code/_personal_projects/line-puzzle/src/Area.ts\",\"external\":\"file:///Users/phoenix/Code/_personal_projects/line-puzzle/src/Area.ts\",\"path\":\"/Users/phoenix/Code/_personal_projects/line-puzzle/src/Area.ts\",\"scheme\":\"file\"},\"encoding\":\"utf8\"}" }, { "id": "workbench.editors.files.fileEditorInput", "value": "{\"resourceJSON\":{\"$mid\":1,\"fsPath\":\"/Users/phoenix/Code/_personal_projects/line-puzzle/src/Cell.ts\",\"external\":\"file:///Users/phoenix/Code/_personal_projects/line-puzzle/src/Cell.ts\",\"path\":\"/Users/phoenix/Code/_personal_projects/line-puzzle/src/Cell.ts\",\"scheme\":\"file\"},\"encoding\":\"utf8\"}" }, { "id": "workbench.editors.files.fileEditorInput", "value": "{\"resourceJSON\":{\"$mid\":1,\"fsPath\":\"/Users/phoenix/Code/_personal_projects/line-puzzle/tests/board.test.ts\",\"external\":\"file:///Users/phoenix/Code/_personal_projects/line-puzzle/tests/board.test.ts\",\"path\":\"/Users/phoenix/Code/_personal_projects/line-puzzle/tests/board.test.ts\",\"scheme\":\"file\"},\"preferredResourceJSON\":{\"$mid\":1,\"fsPath\":\"/Users/phoenix/Code/_personal_projects/line-puzzle/tests/Board.test.ts\",\"external\":\"file:///Users/phoenix/Code/_personal_projects/line-puzzle/tests/Board.test.ts\",\"path\":\"/Users/phoenix/Code/_personal_projects/line-puzzle/tests/Board.test.ts\",\"scheme\":\"file\"},\"encoding\":\"utf8\"}" }, { "id": "workbench.editors.files.fileEditorInput", "value": "{\"resourceJSON\":{\"$mid\":1,\"fsPath\":\"/Users/phoenix/Code/_personal_projects/line-puzzle/tests/Area.test.ts\",\"external\":\"file:///Users/phoenix/Code/_personal_projects/line-puzzle/tests/Area.test.ts\",\"path\":\"/Users/phoenix/Code/_personal_projects/line-puzzle/tests/Area.test.ts\",\"scheme\":\"file\"},\"encoding\":\"utf8\"}" }, { "id": "workbench.input.settings2", "value": "" }, { "id": "workbench.editors.files.fileEditorInput", "value": "{\"resourceJSON\":{\"$mid\":1,\"fsPath\":\"/Users/phoenix/Library/Application Support/Code/User/settings.json\",\"external\":\"vscode-userdata:/Users/phoenix/Library/Application%20Support/Code/User/settings.json\",\"path\":\"/Users/phoenix/Library/Application Support/Code/User/settings.json\",\"scheme\":\"vscode-userdata\"},\"encoding\":\"utf8\"}" } ], "mru": [ 3, 6, 5, 4, 0, 1, 2 ] }, "size": 965 } ], "size": 609 }, "orientation": 1, "width": 965, "height": 609 }, "activeGroup": 3, "mostRecentActiveGroups": [ 3 ] } } ```

Expected Behavior

The gutter icons should stay in place even after renaming the file with different capitalization.

Actual Behavior

The gutter icons disappear, and the exception is only underlined (not expanded).

Screenshot taken in my original bug case, where I renamed board.test.ts to Board.test.ts:

Screen Shot 2021-12-12 at 21 58 52

Workaround

The workaround is to close any affected file tabs, quit VS Code, relaunch, and then reopen the files.

connectdotz commented 2 years ago

yes I can indeed reproduce this issue, however, it turns out that this is a known issue within vscode because it does not support case sensitivity for macOS: microsoft/vscode#94307

I know, hard to believe... feel free to add your voice there. I am afraid we won't be able to address this use case until vscode fixes the issue above.