Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

codeActionsOnSave shows file changes as unsaved #72496

Closed
manospasj opened this issue Apr 17, 2019 · 14 comments
Closed

codeActionsOnSave shows file changes as unsaved #72496

manospasj opened this issue Apr 17, 2019 · 14 comments
Assignees
Labels
info-needed Issue requires more information from poster typescript Typescript support issues

Comments

@manospasj
Copy link

manospasj commented Apr 17, 2019

Issue Type: Bug

Since the update to VS Code 1.33 the editor.codeActionsOnSave setting does not work as expected. When saving a file the defined actions run but then the file is unsaved. Sometimes the file gets saved but not always. This worked fine in VS Code 1.32.

My VS Code settings are:

{
  "workbench.startupEditor": "newUntitledFile",
  "editor.formatOnSave": true,
  "[handlebars]": {
    "editor.formatOnSave": false
  },
  "files.exclude": {
    "node_modules/": true
  },
  "git.autofetch": true,
  "git.enableSmartCommit": true,
  "prettier.tslintIntegration": true,
  "typescript.updateImportsOnFileMove.enabled": "always",
  "editor.codeActionsOnSave": {
    "source.organizeImports": true,
    "source.fixAll": true
  },
  "[typescriptreact]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  }
}

If I change the source.organizeImports and source.fixAll settings to false the issue everything works fine.

VS Code version: Code 1.33.1 (51b0b28, 2019-04-11T08:27:14.102Z)
OS version: Windows_NT x64 10.0.17134

System Info
Item Value
CPUs Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz (8 x 1992)
GPU Status 2d_canvas: enabled
checker_imaging: disabled_off
flash_3d: enabled
flash_stage3d: enabled
flash_stage3d_baseline: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
native_gpu_memory_buffers: disabled_software
rasterization: enabled
surface_synchronization: enabled_on
video_decode: enabled
webgl: enabled
webgl2: enabled
Memory (System) 15.73GB (5.74GB free)
Process Argv
Screen Reader no
VM 0%
Extensions (8)
Extension Author (truncated) Version
cform aws 0.0.15
gitlens eam 9.6.1
EditorConfig Edi 0.13.0
tslint eg2 1.0.43
prettier-vscode esb 1.8.1
dotenv mik 1.0.1
debugger-for-chrome msj 4.11.3
vscode-yaml red 0.4.0
@vscodebot vscodebot bot added the editor-contrib Editor collection of extras label Apr 17, 2019
@bpasero
Copy link
Member

bpasero commented Apr 17, 2019

Can you try to reproduce with our nightly insider builds? You can give our preview releases a try from: https://code.visualstudio.com/insiders/

@bpasero bpasero added the info-needed Issue requires more information from poster label Apr 17, 2019
@manospasj
Copy link
Author

I just tried the nightly insider build without any extensions and it does the same thing. I also played a bit with the settings and it seems that the only setting causing this is the source.organizeImports, as setting it to false fixes the issue.

@bpasero
Copy link
Member

bpasero commented Apr 17, 2019

@manospasj can you give me an exact repro how you get there?

@bpasero bpasero self-assigned this Apr 17, 2019
@bpasero bpasero added this to the April 2019 milestone Apr 17, 2019
@bpasero bpasero removed the editor-contrib Editor collection of extras label Apr 17, 2019
@bpasero
Copy link
Member

bpasero commented Apr 18, 2019

@manospasj ping

@manospasj
Copy link
Author

@bpasero I tried to create a repro but I can't reproduce it with a hello world app. It only seems to be happening with the project I'm working on. I'll do some more investigation and see if I can find something more helpful.

@bpasero
Copy link
Member

bpasero commented Apr 18, 2019

/duplicate #72343

@vscodebot vscodebot bot added the *duplicate Issue identified as a duplicate of another issue(s) label Apr 18, 2019
@vscodebot
Copy link

vscodebot bot commented Apr 18, 2019

Thanks for creating this issue! We figured it's covering the same as another one we already have. Thus, we closed this one as a duplicate. You can search for existing issues here. See also our issue reporting guidelines.

Happy Coding!

@vscodebot vscodebot bot closed this as completed Apr 18, 2019
@manospasj
Copy link
Author

@bpasero Sorry for my late response but I was not in the office for a couple of days. This is not a duplicate of #72343. I tried the latest insiders build as suggested in #72343 but this is not fixed.

I know I'm not giving you enough info to reproduce it, but I'm not sure what's causing it and thus I can't create a repro to demonstrate it. I can only reproduce it in a work project which is not open source and I can't share. Maybe I can show you using TeamViewer?

@bpasero
Copy link
Member

bpasero commented Apr 30, 2019

@manospasj this is with a typescript project right?

@manospasj
Copy link
Author

Yes this is a react with typescript project. Here is my full package.json, if that helps. I have also noticed that it happens more often when I'm running the project.

{
  "name": "my-app",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@types/google-map-react": "^0.23.10",
    "@types/history": "^4.7.2",
    "@types/jest": "23.3.9",
    "@types/lodash": "^4.14.119",
    "@types/node": "10.12.10",
    "@types/react": "16.7.7",
    "@types/react-dom": "16.0.10",
    "@types/react-router-dom": "^4.3.1",
    "@types/styled-components": "^4.1.1",
    "cross-env": "^5.2.0",
    "google-map-react": "^1.1.2",
    "history": "^4.9.0",
    "i18next": "^15.0.6",
    "lodash": "^4.17.11",
    "node-sass": "^4.10.0",
    "react": "^16.8.4",
    "react-dom": "^16.8.4",
    "react-grid-layout": "^0.16.6",
    "react-i18next": "^10.4.2",
    "react-router-dom": "^4.3.1",
    "react-scripts": "^2.1.8",
    "react-testing-library": "^5.4.4",
    "rxjs": "^6.3.3",
    "styled-components": "^4.1.1",
    "tslint": "^5.11.0",
    "tslint-react": "^3.6.0",
    "typescript": "3.1.6",
    "yargs": "^12.0.5"
  },
  "scripts": {
    "start": "node scripts/environment --config development react-scripts start",
    "start:local": "node scripts/environment --config local react-scripts start",
    "build": "node scripts/environment --config development react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject",
    "lint": "tslint 'src/**/*.tsx' 'src/**/*.ts'",
    "gen": "plop --plopfile ./src/utils/generators/index.js && prettier --loglevel error --write \"./src/**/*.tsx\""
  },
  "eslintConfig": {
    "extends": "react-app"
  },
  "browserslist": [
    ">0.2%",
    "not dead",
    "not ie <= 11",
    "not op_mini all"
  ],
  "devDependencies": {
    "@types/react-grid-layout": "^0.16.7",
    "inquirer-directory": "^2.1.0",
    "plop": "^2.1.0",
    "prettier": "^1.14.3"
  }
}

@bpasero bpasero reopened this May 1, 2019
@bpasero bpasero added typescript Typescript support issues and removed *duplicate Issue identified as a duplicate of another issue(s) info-needed Issue requires more information from poster labels May 1, 2019
@bpasero bpasero assigned mjbvz and unassigned bpasero May 1, 2019
@bpasero bpasero removed this from the April 2019 milestone May 1, 2019
@mjbvz
Copy link
Collaborator

mjbvz commented May 1, 2019

@manospasj When this happens, can you please run the Developer: Toggle developer tools command in VS Code to open the developer tools. In the developer tools console, do you see any messages about codeActionOnSave timeout or other errors?

@bpasero bpasero added the info-needed Issue requires more information from poster label May 2, 2019
@manospasj
Copy link
Author

manospasj commented May 2, 2019

@mjbvz yes there is a warning WARN Aborted codeActionsOnSave after 750ms in workbench.main.js:1401

@mjbvz
Copy link
Collaborator

mjbvz commented May 4, 2019

Are other language features, such as intellisense, responsive in this workspace or are they slow/sluggish?

Can you also please make sure you have the latest version of @types/styled-components installed. See DefinitelyTyped/DefinitelyTyped#34391 for details

@manospasj
Copy link
Author

Upgrading to the latest version of @types/styled-components did the trick. Thanks @mjbvz

@vscodebot vscodebot bot locked and limited conversation to collaborators Jun 18, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
info-needed Issue requires more information from poster typescript Typescript support issues
Projects
None yet
Development

No branches or pull requests

3 participants