coc-tsserver icon indicating copy to clipboard operation
coc-tsserver copied to clipboard

How do I avoid `jumpImplementation` from jumping to type file

Open davidsu opened this issue 3 years ago • 5 comments

I have a custom handler to fallback to regex search function implementation when I can't find one with ts-server. It happens quite often on the monorepos I work that I can easily find the function declared on another subproject but using CocAction('jumpImplementtion') jumps to .d.ts files. Is there some way to tell ts-server to filter out .d.ts files from possible jumpLocations for jumpImplemention?

davidsu avatar May 22 '21 13:05 davidsu

Don't know, you need ask typescript team.

chemzqm avatar May 22 '21 15:05 chemzqm

Or maybe create plugin of tsserver could help

chemzqm avatar May 22 '21 15:05 chemzqm

I should have started by saying that I love your work. I really do. What im doing is to map gd to a custom function that tries to jumpimplementation and fallsback to regex search if typescript don't have implementation location. I endedup using feedkeys(<c-o>.... if i endup in a d.ts file and then fallingback to regex, works well enough for me. Thanks

davidsu avatar May 22 '21 20:05 davidsu

This is already supported with project references and declarationMap: true. I've used this in yarn workspace monorepos as well as lerna/npm monorepos to jump between subprojects.

JamesApple avatar Jun 03 '21 13:06 JamesApple

@JamesApple looks like create-react-app doesn't play well with project references. There are clever solutions to the problems of CRA, it's a bit of an overkill for me at this time. I'm happy enough with my hacks for now. It was fun to learn about it, thank u for that.

davidsu avatar Jun 03 '21 14:06 davidsu