Skip to content
This repository has been archived by the owner on Oct 12, 2022. It is now read-only.

[Feature Request] Syntax highlighting for functions and operators #4271

Closed
mhmdmodan opened this issue Jan 25, 2018 · 6 comments
Closed

[Feature Request] Syntax highlighting for functions and operators #4271

mhmdmodan opened this issue Jan 25, 2018 · 6 comments

Comments

@mhmdmodan
Copy link

RStudio has an optional feature to enable highlighting for functons, which offers a great increase in readability. Additionally, separate highlighting for operators, including custom binary operators (like the pipe %>%) would be quite helpful as well!

Here's a bit of code in RStudio:

image

And the same with RTVS:

image

Hopefully this can be implemented in future updates. Thank you!

@MikhailArkhipov
Copy link
Contributor

VS has operator colors :-) It is just default is black.

image

Function colors somewhat more difficult since it technically requires semantic analysis. However, simple approach would be to color anything that has following ( (except keywords) as functions.

@MikhailArkhipov MikhailArkhipov self-assigned this Jan 25, 2018
@mhmdmodan
Copy link
Author

Ah! Thank you, didn't see that in the settings. I'm new to VS :)

As for the function call highlighting, looks like that's what RStudio does too.

image

@MikhailArkhipov
Copy link
Contributor

Not too complicated, but fairly extensive change. Classifier currently gets a single token while it needs to get token collection and the current token index so it can determine if this is a function. Unfortunately, connection operations currently return elements and not indices. Also, tokenizer needs to run past the changed range since it needs to pick up the brace while it might be off-screen. Example

func|( <<- edge of the screen

VS request for colors in the range would not include '(` since it is off screen. Tokenizer needs to picks few items beyond .the visual range then

@MikhailArkhipov
Copy link
Contributor

@mhmdmodan - which RStudio scheme it is? In the schemes I have I don't see option for function colors.

image

@mhmdmodan
Copy link
Author

@MikhailArkhipov - Hi, it must be enabled in the Code menu under the Display tab first.

image

@MikhailArkhipov
Copy link
Contributor

e83ab28

The color name is R Function. Default is black.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants