Closed kortenkamp closed 1 year ago
This is a tricky problem for a couple of reasons:
That said, it is certainly possible to do these things, but it would take legwork in the client app.
TokenMaker
and overriding addToken with logic like:if (tokenType == TokenTypes.FUNCTION && stdlibFunctionSet.contains(new String(array, start, end))) {
tokenType = myCustomTokenType;
}
Parser
is called after a small delay whenever the editor's contents are modified. Parsers are designed to squiggle-underline warnings and errors, but they can also be used to build say an AST of the editor's contents, which can then be used by your TokenMaker
to decide how to colorize tokens.
Describe the solution you'd like For most languages, calling a function needs a certain, fixed number of parameters. E.g.,
call( 1, 2)
is a different function call thancall (5)
. It would be nice to be able to give a visual clue whether that call is actually defined – that is, allow for the information whethercall
is a token of typeknown_function
orunknown_function
.Are there any workarounds? Maybe it is possible to extract that information when parsing the line somehow. I would be grateful for hints about any existing parsers that can do similar things.
Additional context A similiar problem would be to identify whether a certain identifier denotes a built-in function or a user-defined function. Again, this depends on parsing of the full file.