0

I am wondering if there is a way to activate VScode peek definition function for a custom language.

I am writing cadence skill using it, but I can highlight the syntax but not be able to use this to locate the definition quickly.

Gama11
  • 31,714
  • 9
  • 78
  • 100

1 Answers1

1

"Peek Definition" uses the same funcionality under the hood as the regular "Go to Definition". You need to implement a DefinitionProvider using vscode.languages.registerDefinitionProvider(). For a code example, check out this previous answer of mine.

Alternatively, if you're using the language server protocol instead of coding against the VSCode API directly, the Goto Definition Request needs to be implemented.

Gama11
  • 31,714
  • 9
  • 78
  • 100
  • Hi, thanks for the help on developing, but I wonder if you know how to highlight the code in peek definition window? – Perseus Wang CN Aug 06 '19 at 02:46
  • The range you specify in the result should take care of that.. Or what exactly do you mean by highlighting? – Gama11 Aug 06 '19 at 09:06
  • by passing the range as the parameter, it works. thanks, there should be a light yellow colour to highlight the definition part, that's what I mean, appreciate for the help – Perseus Wang CN Aug 09 '19 at 03:35