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

Syntax Highlighting is Worse With typescript-vim #175

Open
greenymcgee opened this issue Jan 12, 2020 · 2 comments
Open

Syntax Highlighting is Worse With typescript-vim #175

greenymcgee opened this issue Jan 12, 2020 · 2 comments

Comments

@greenymcgee
Copy link

greenymcgee commented Jan 12, 2020

I've been trying to get syntax highlighting working for typescript in vim for over a week now. If I don't have any plugins installed, then I get some synstack options that are decent like typescriptArrowFuncArg and typescriptParenExp. I can begin making some positive changes to the way ts pages look with those and many more, but vim gets confused in highly typed pages. For example:

export const sessionActions = {
  updateUserAttributes: (params: SomeLibraryType) => async (
    dispatch: Dispatch,
  ): Promise<void> => {
    dispatch<Types.MyType>({
      type: ActionType.MY_ACTION_TYPE,
    });
    try {
      // some things
    } catch (err) {
      // some other things
    }
  },
};

Once we reach dispatch, vim thinks we're inside of an object rather than a function, so dispatch and try are being recognized as typescriptObjectLabel when they are in fact inside of a function.

I was hoping that adding typescript-vim would solve the issue, but when I do that almost everything on the page gets a synstack that looks like: [foldBraces, foldBraces, foldBraces]. I'm assuming that's not what is supposed to happen.

I'm using VIM - Vi IMproved 8.1 on a MacBook Pro that is running Mojave. To be transparent, this is the first issue I've ever submitted to a repo that I'm not working in. I'll be happy to provide more info if I need to, but I hope that I've provided at least enough to get started.

@greenymcgee
Copy link
Author

Here are my vimfiles: https://github.com/greenymcgee/vim-files

This could absolutely be user error. You can look at my gitmodules to see the other plugins that I'm currently running. I don't have typescript-vim committed as a submodule, but I've been installing and uninstalling as I try to debug.

@leafgarland
Copy link
Owner

Hello - thanks for the report.

Recent Vim versions now comes bundled with a typescript setup (vim/vim@773a97c) based on https://github.com/HerringtonDarkholme/yats.vim - so that is likely what is providing the syntax highlighting you see with no other plugins.

Your original reports might be better given to yats.vim, assuming it still applies after you've tried their latest version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants