vscode icon indicating copy to clipboard operation
vscode copied to clipboard

Editor Bug: Auto-indent does not work correctly in TypeScript files

Open gilboa23 opened this issue 10 years ago • 12 comments

  • VSCode Version: 0.10.11
  • OS Version: Windows 7 / 64-bit

Steps to Reproduce:

  1. Click Enter at the end of a nested line (e.g., after if / for statement).
  2. A new line is created, but the cursor is placed at the beginning of the line instead of the expected indented position.

After the new line is completed, the indentation is fixed. But i would expect the indentation to be correct already when the line is just created.

gilboa23 avatar Apr 22 '16 12:04 gilboa23

@gilboa23 I assume you have format on type. Could you provide a screen cast showing the problem (animated gif) or better the project with steps how to reproduce this. I am asking since I can't reproduce this:

bug

dbaeumer avatar Apr 22 '16 15:04 dbaeumer

See screencast below (vscode 1.0.0, editor.formatOnType==true).

As can be seen, when creating a new line, the cursor is initially placed at column 0 instead of the column that corresponds to the current nesting level. The indentation is fixed only when the line is completed (by entering the semi-colon).

indentation-issue

gilboa23 avatar Apr 22 '16 16:04 gilboa23

@gilboa23 I still can't reproduce. Could you share your workspace. May be it is another settings that needs to be different. What kind of line ending do you use? Did you tweak the typescript formatter options?

dbaeumer avatar Apr 22 '16 19:04 dbaeumer

Or do you have any additional plugins installed?

dbaeumer avatar Apr 22 '16 19:04 dbaeumer

I have the same problem with JavaScript files. Using v1.0.1-insider on Mac OSX. My plugins installed are eslint, tslint and editorconfig.

4kochi avatar Apr 22 '16 20:04 4kochi

@jrieken I am out on vacation for two weeks. Can you please follow up.

dbaeumer avatar Apr 23 '16 19:04 dbaeumer

@gilboa23 @4kochi could you start vscode from a command prompt with --disable-extensions and lets us know if you still experience the problems.

dbaeumer avatar Apr 23 '16 19:04 dbaeumer

I think i found the cause for the issue in my project. The "typescript.tsdk" parameter in the settings file was set to an older version of typescript lib (v1.8.0). I cleared the flag and this seems to have solved the issue.

I'm closing this issue. Thank you for your assistance.

gilboa23 avatar Apr 24 '16 18:04 gilboa23

I still have the problem, also with disabled extensions. But as I said if have .js file instead of .ts files. I also tried a never typescript version with the setting:

"typescript.tsdk": "/usr/local/lib/node_modules/typescript/lib"

The typescript version is Version 1.9.0-dev.20160423

vscode

4kochi avatar Apr 25 '16 06:04 4kochi

@4kochi What you are seeing is #3797

jrieken avatar Apr 25 '16 07:04 jrieken

Ok, thanks for clarification.

4kochi avatar Apr 25 '16 09:04 4kochi

pls see https://github.com/Microsoft/vscode/issues/3797#issuecomment-214650742 for how to use Code with a new version of TypeScript.

egamma avatar Apr 26 '16 07:04 egamma