leafgarland / typescript-vim

Typescript syntax files for Vim
1.89k stars 142 forks source link

Syntax highlighting broken after generic #156

Open SkyLeite opened 5 years ago

SkyLeite commented 5 years ago

Self explanatory.

image

image

Code:

import * as React from "react";
import { Table } from "semantic-ui-react";
import { Example } from "../types";

class AppTable extends React.PureComponent<Props, State> {

    async componentDidMount() {
        const exampleResponse = await fetch("http://localhost:8000/examples");
        if (exampleResponse.status !== 200) {
            return console.error("Dispatch redux error action");
        }

        const examples = await exampleResponse.json();
        this.setState({
            examples
        });
    }
}

type Props = {}
type State = {
    examples: Example[];
}

export default AppTable;
leafgarland commented 5 years ago

Thanks for the bug report!

leafgarland commented 5 years ago

Hm. I get the same highlighting with or without the generic arguments. Also I don't get any highlighting of the generic arguments, e.g. your screenshot shows different colours for Props and State.

jcartledge commented 5 years ago

I'm experiencing the same issue as the original reporter, but I noticed it works if the filetype is typescript.tsx as opposed to typescript. (This project is not using React or JSX/TSX, it's just plain TypeScript.)

leahein commented 4 years ago

I'm experiencing the same issue. Syntax highlighting breaks when using generics. This only happens in .ts files, and not in .tsx files.

With generic: image

Without generic: image