Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Highlight function after and the "|>" symbol itself #154

Open
Vgrunert opened this issue Jul 28, 2018 · 5 comments
Open

Highlight function after and the "|>" symbol itself #154

Vgrunert opened this issue Jul 28, 2018 · 5 comments

Comments

@Vgrunert
Copy link

Hi,

I am using the "|>" symbol heavily in my coding, unfortunately neither the symbol itself nor the function that follows it is highlighted which makes reading the code a bit more difficult.

Generally the syntax of using the "|>" symbol is as following:

"variable |> function". This is equal to "function( variable )", only expressed differently.
It would be really nice if these were colour coded as other function, with a separate colour for the "|>" symbol.

Unfortunately I am not familiar with coding of the colours for the text editor, so I am a bit overwhelmed when looking at the file in the package folder.

Nevertheless, it would be a useful thing tho have.

@CameronBieganek
Copy link

I agree, it would be nice if the function names following a pipe operator got tokenized as support.function:

@zapazite
Copy link

Hi , is it something to change only here or is it much more difficult?

@CameronBieganek
Copy link

The file you linked to is some kind of test file or specification file. The grammar lives in this file. The Julia grammar is a TextMate Grammar. Learning how to write TextMate grammars is a rather deep rabbit-hole to go down...

@zapazite
Copy link

zapazite commented Nov 28, 2020

I see it is quite a rabbit-hole, It is never easy unfortunately, Thanks you for the good links by the way.
After reading for a bit (I still don't understand anything). I guess we need some kind of "Positive Lookbehind" in this line.
Something like (?<=|>) with the pipe operator inside but with blank space after it.
Still we need to be sure that there is no use case where we can pipe |> to something else than a function cause my naive way to implement will consider every "word" after |> to be a function.I can see now there is many others things to consider.
Anyway I clearly don't understand what I am talking about.
I was thinking that the function's names where available somehow (after defining it and running it at least one time) to the text editor and that we could do something simpler to recognize it.

@CameronBieganek
Copy link

I was thinking that the function's names where available somehow (after defining it and running it at least one time) to the text editor and that we could do something simpler to recognize it.

There is a chance that someday we will have semantic highlighting (see here), which uses tokens provided by the Julia Language Server. However, the language server tokens (which would be generated by CSTParser.jl) would still be based only on a lexical analysis of the source code. So even CSTParser.jl doesn't actually evaluate any of your code (or at least I don't think it does), and the language server and the linter are not tracking the code that you run in the REPL.

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

No branches or pull requests

4 participants