Skip to content

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

Open
@phoenixeliot

Description

@phoenixeliot

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): [email protected]
  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.

  1. Operating system: macOS 11.6.1

Prerequisite

  • are you able to run jest test from the command line? Yes.
  • how do you run your tests from the command line? (for example: npm run test or node_modules/.bin/jest) jest

Steps to Reproduce

  1. Clone this repo at this commit: phoenixeliot/line-puzzle@fa953e9
  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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    external-issueissues caused by external system ( (no fix needed)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions