pangloss / vim-javascript

Vastly improved Javascript indentation and syntax support in Vim.
http://www.vim.org/scripts/script.php?script_id=4452
3.8k stars 358 forks source link

[Flow] Nested Generic Types break syntax highlighting #1234

Open vctrshn opened 3 years ago

vctrshn commented 3 years ago

It seems like using nested generic types ends up breaking syntax highlighting for the rest of the file.

Minimal Repro

// @flow                                                                                                                                                                                                                                                                                                                                       
const OOF = new Map<number, Map<number, string>>();                                                                                                                                                                                                                                                                                            

export function thing(): Array<number> {                                                                                                                                                                                                                                                                                                       
  return [1, 2, 3];                                                                                                                                                                                                                                                                                                                            
}
Screen Shot 2021-04-25 at 5 20 59 PM

Formatting the code this way doesn't cause the same problem, if it helps track down the root cause:

// @flow                                                                                                                                                                                                                                                                                                                                       
const OOF = new Map<                                                                                                                                                                                                                                                                                                                           
  number,                                                                                                                                                                                                                                                                                                                                      
  Map<                                                                                                                                                                                                                                                                                                                                         
    number,                                                                                                                                                                                                                                                                                                                                    
    string,                                                                                                                                                                                                                                                                                                                                    
  >                                                                                                                                                                                                                                                                                                                                            
>();                                                                                                                                                                                                                                                                                                                                           

export function thing(): Array<number> {                                                                                                                                                                                                                                                                                                       
  return [1, 2, 3];                                                                                                                                                                                                                                                                                                                            
}      
Screen Shot 2021-04-25 at 5 22 46 PM

Thanks in advance for your help!

shannonmoeller commented 3 years ago

I commented out this line and it seems to be working on my machine now. Not sure what the ramifications are.

https://github.com/pangloss/vim-javascript/blob/master/extras/flow.vim#L12

It was added in #1161.