Skip to content

Syntax Highlighting is Worse With typescript-vim #175

@greenymcgee

Description

@greenymcgee

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.

Activity

greenymcgee

greenymcgee commented on Jan 12, 2020

@greenymcgee
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

leafgarland commented on Feb 12, 2020

@leafgarland
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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Syntax Highlighting is Worse With typescript-vim · Issue #175 · leafgarland/typescript-vim