typescript-vim icon indicating copy to clipboard operation
typescript-vim copied to clipboard

Fix indentation

Open thejohnfreeman opened this issue 5 years ago • 12 comments

There are 3 commits (right now) in this review. The first two updated to the latest indent file from 'pangloss/vim-javascript', and the third switched gears to HerringtonDarkholme/yats.vim. There are a few open issues with "indent" in their name:

  • #93 is already fixed and should be closed.
  • #118 is already fixed and should be closed. (HerringtonDarkholme/yats.vim does the wrong thing in this case, which would be a regression if we adopted their indent file.)
  • #127 is a bug in all three projects.
  • #133 reports two indentation bugs: -- Comma-terminated member declarations within interface declarations. This is also a bug in pangloss/vim-javascript, but not in HerringtonDarkholme/yats.vim. -- Enum declarations. This is a bug in all three projects.
  • #138 is a bug in this project and 'pangloss/vim-javascript', but not in HerringtonDarkholme/yats.vim, which has a separate tsx.vim indent file.

I think TypeScript might be at the point that it deserves its own indent file, however, not one copied from JavaScript or Ruby. No one else is doing it, but I think this project, as the one chosen by sheerun/vim-polyglot for TypeScript, is the perfect candidate.

thejohnfreeman avatar Oct 02 '18 02:10 thejohnfreeman

Hi, thanks for the very thorough write-up! I'm not going to get a chance to look at this for a day or two but will do as soon as I can.

This is just a thought but given that the indent file here is a copy anyway - do you think it is worth keeping one in this repo - perhaps this repo should focus on the syntax?

leafgarland avatar Oct 03 '18 12:10 leafgarland

Any chance of getting this merged? Is it even up to date anymore?

brandoncc avatar Feb 20 '19 04:02 brandoncc

@thejohnfreeman you mentioned using prettier instead, does that mean you have no more interest in this PR? If you still do, let me know as I'm happy to open up the repo to others who have more time.

leafgarland avatar Feb 20 '19 04:02 leafgarland

You're right, I don't need this PR any more. You can close it or hand it off to someone else.

thejohnfreeman avatar Feb 20 '19 16:02 thejohnfreeman

Would be pretty nice to merge this in.

aakropotkin avatar Mar 19 '19 03:03 aakropotkin

@leafgarland what is blocking this PR? the indenting in TS is aweful and painful when writing code.

@thejohnfreeman You don't use Vim for coding anymore? If you do use Vim how do you get indenting working? This is confusing to have a PR fix a problem many are having and yet no option to fix the problem. It seems you did fix the problem with something magical called prettier. How do we enable this option in Vim?

sukima avatar Mar 23 '19 15:03 sukima

@sukima I use ALE and Prettier.

let g:ale_fixers = {
      \  'javascript': ['prettier'],
      \  'typescript': ['prettier'],
      \}
let g:ale_fix_on_save = 1
$ yarn add -D prettier
# Once Prettier is installed in node_modules, ALE calls it automatically.

thejohnfreeman avatar Mar 23 '19 22:03 thejohnfreeman

@sukima Nothing blocking it but having the author not use it makes me less keen to bring in a big change that nobody is vested in. Does this PR improve things for you?

leafgarland avatar Mar 25 '19 01:03 leafgarland

I don’t know I didn’t try it. I might try it later. All I know is that indentation doesn’t work and I (like others) would like it to work. I am curious why you haven’t run into this same issue especially if dog-fooding is important.

sukima avatar Mar 27 '19 04:03 sukima

Hey I’ve been using Prettier for the last several weeks, and while I like it, it is definitely not a Vim indent solution. Its more like GNU indent where it gets run on a whole file modifying it.

aakropotkin avatar Mar 27 '19 13:03 aakropotkin

@sukima editing typescript is only a small part of my work currently and I have not had any issues with indenting. I am not in a position to dog-food this plugin anymore.

If anyone who does edit lots of typescript in vim would like to try this PR and say that it works better, then I am happy to merge it.

leafgarland avatar Mar 27 '19 23:03 leafgarland

@leafgarland I spend most of my time either writing python or writing typescript (much of it in tsx) - I have definitely come to notice and struggle with the indenting in .tsx files.

At your suggestion, I tried to use this PR, and it had only been a couple hours so far, but I had noticed a definite improvement. There were still a few oddities, but it seems to have handled a few of the egregious issues. Then I looked, and saw that I hadn't even installed the pull request branch properly in Vundle, and I was just getting the experience without any typescript-vim installed! I'm not sure what exactly is causing the issue with the indentations in .tsx and typescript-vim, I'm not aware of any conflicting plugins I might have installed.

FWIW, I properly installed this pull request after my screw up, and noticed no improvement as far as indentation issues in .tsx files.

For now I have decided to opt for the indentation disable setting: let g:typescript_indent_disable = 1

mcabrams avatar Jul 17 '19 02:07 mcabrams