pocmatos
2019-1-31 10:30:33

phew, that’s really cold. And yet, I keep complaining about +1 C outside.


pocmatos
2019-1-31 10:31:15

How can I avoid section numbering in scribble files? This is related to using scribble files in frog. Section numbers in a post just look wrong. @greg?


ryanc
2019-1-31 10:49:35

@pocmatos use @section[#:style 'unnumbered]{Section title}


pocmatos
2019-1-31 10:52:43

@ryanc thanks


wybitul.evzen
2019-1-31 12:13:01

@wybitul.evzen has joined the channel


wybitul.evzen
2019-1-31 12:59:10

Hey! I’m working on a syntax-highlighting plugin for VSCode, but it’s still early work in progress. I managed to fix number scoping with the help of Jens from our google group, so I figured I might ask some questions here as well.


wybitul.evzen
2019-1-31 12:59:15

jerome.martin.dev
2019-1-31 13:04:03

@wybitul.evzen Awesome! I put together a similar syntax file for SublimeText & Amp, but it’s really not accurate so I didn’t post it publicly yet. I’ll check if I can get some inspiration from your work :slightly_smiling_face:


wybitul.evzen
2019-1-31 13:05:33

Currently, the first symbol in a list is highlighted as a function call; it’s a little brittle, though (things like ( #;(sexp comments ftw) map add1 '(1 2 3 4) ) don’t work), and sometimes outright incorrect: (let ([x 1] [y 2])) highlights the x and y as functions. So, the question is: should I drop this “feature” altogether? DrRacket simply highlights known functions (exported from racket) and the rest is plain “symbols”.


jerome.martin.dev
2019-1-31 13:06:53

I kinda like the "first symbol is different’ rule, but I guess it’s a personal preference


wybitul.evzen
2019-1-31 13:07:03

@jerome.martin.dev I’m not sure how syntax highlighting works for Sublime, but I guess it’s got something to do with textMate as well. My grammar file is a .yaml, so maybe I’d be able to export it to the SublimeText format. That means we could join forces on the project and make it the standart across more editors than just VSCode :slightly_smiling_face:


jerome.martin.dev
2019-1-31 13:07:32

I’d be glad to join force on this, definitely! Writing good syntax files is hard and time consuming


jerome.martin.dev
2019-1-31 13:08:21

The sublime syntax was textMate before, but changed to a new custom “sublimeSyntax” system. Amp decided to use the same system as sublime


jerome.martin.dev
2019-1-31 13:09:25

most of the time, they’re just regexps with greedy/not greedy rules


wybitul.evzen
2019-1-31 13:09:27

Just checked out their webpage. It says > Sublime Syntax files are YAML files with a small header, followed by a list of contexts. […]


wybitul.evzen
2019-1-31 13:10:02

Seems good. Maybe no conversion will be needed, or maybe just some manual key-changing.


jerome.martin.dev
2019-1-31 13:10:08

a bit


jerome.martin.dev
2019-1-31 13:10:12

it looks like this :



jerome.martin.dev
2019-1-31 13:11:00

(I did this one for Forth, but also did one for Racket I didn’t published)


wybitul.evzen
2019-1-31 13:12:16

Well, now that I’m looking into it, the semantics are little different. It seems to be more powerful than the textmate style, and has some additional constructs, too.


jerome.martin.dev
2019-1-31 13:12:24

yep


jerome.martin.dev
2019-1-31 13:12:55

most keys are custom, you can choose the names


jerome.martin.dev
2019-1-31 13:13:01

then put them together


jerome.martin.dev
2019-1-31 13:13:46

the only real keywords are “match”, “push”, “pull”, “scope”, “pop”


jerome.martin.dev
2019-1-31 13:14:03

it works like a stack machine with regexps


wybitul.evzen
2019-1-31 13:15:37

Yep, that’s the notion I got from their webpage as well. I think the “ideas” will translate very well, though.


wybitul.evzen
2019-1-31 13:16:33

And it seems you’ll be able to handle quotes and unquotes correctly. Pushing and popping a stack, so you’ll be able to correctly asses whether the things are quoted, or unquoted, even in some deeply nested scenarios.


wybitul.evzen
2019-1-31 13:16:44

Pretty cool.


jerome.martin.dev
2019-1-31 13:16:47

yep :slightly_smiling_face:


alexknauth
2019-1-31 13:17:48

Some kind of stack (explicit or implicitly handled by the language) will be necessary to count the parantheses for anything like a #;(s-exp) comment


wybitul.evzen
2019-1-31 13:18:58

Oh hey. You’re the guy from SO!


wybitul.evzen
2019-1-31 13:20:02

Yep. One can emulate this in textmate grammars by matching begin: #;( and end: ) and between it some things like parentheses, strings etc.


wybitul.evzen
2019-1-31 13:21:10

The problems is, I’d have to basically have two grammars: one for those normal constructs which would scope them under numbers, strings etc, and other, which could recognize them just as well, but scope them under comments. 1kloc → 2kloc in a blink. Not worth it just for the comments, I think.


alexknauth
2019-1-31 13:21:50

Grammars (things like context-free-grammars or CFGs) implicitly handle a stack for you, which is really convenient


wybitul.evzen
2019-1-31 13:22:51

I’ll have to read more on those grammars you keep mentioning. They work somehow like a Haskell Parser would, right?


wybitul.evzen
2019-1-31 13:23:04

(sorry, don’t know better example)


alexknauth
2019-1-31 13:23:17

Are you referring to Parsec?


wybitul.evzen
2019-1-31 13:23:33

Yep. Or Trifecta. They all work similarly, I think.


wybitul.evzen
2019-1-31 13:25:06

At least… The way one works with them is really similar to the grammar spec in Racket’s docs (e.g. in the Reader–Numbers section). Not sure if this kind of “grammar” is the same as the CFG you talk about.


alexknauth
2019-1-31 13:26:30

The grammars in the racket docs are a variant of CFG, and I think technically they have the same “power” as in they can compute the same class of things


alexknauth
2019-1-31 13:27:52

And that “power” is greater than a regular expression, but less than a full (turing-complete) programming language


wybitul.evzen
2019-1-31 13:28:15

Seems really interesting. Shame it can’t be used to make the syntax highlighting better…


alexknauth
2019-1-31 13:28:32

There are different levels of syntax highlighting.


alexknauth
2019-1-31 13:28:57

The first level just tell whether some group of characters is a string or a symbol or a paren or something


alexknauth
2019-1-31 13:29:26

That level can’t / shouldn’t count parens, so it wouldn’t be able to deal with s-expression comments


alexknauth
2019-1-31 13:29:52

That first level could be expressed with regular expressions


alexknauth
2019-1-31 13:31:40

The second level could deal with well-formed expressions according to a grammar, a CFG (or anything that can handle a stack)


alexknauth
2019-1-31 13:32:59

that level would be able to handle s-expression comments, and if you want it could also handle coloring matching parens-pairs the same color while making them all different, like a rainbow or something


alexknauth
2019-1-31 13:35:38

And that level would be able to distinguish the first element of a function call, even if there was an s-expression comment in the way, or if that first element was a complex expression like (compose (λ (x) (map add1 x)) range), within ((compose (λ (x) (map add1 x)) range) 5)


alexknauth
2019-1-31 13:35:53

Then a third level could deal with scoping


alexknauth
2019-1-31 13:36:42

The third level could tell that the x from (map add1 x) is bound by the x in (λ (x) above it


alexknauth
2019-1-31 13:37:40

Or that map comes from Racket and not a local-variable


alexknauth
2019-1-31 13:38:37

To distinguish that from (let ([map list]) (map add1 x))


wybitul.evzen
2019-1-31 13:40:24

That would be cool to have in so many languages. You can’t guess that from syntax alone, though, can you? In some lightweight way, I mean, without trying to “run” portions of the code.


wybitul.evzen
2019-1-31 13:41:04

Especially when somebody can ruin your day with macros or similar things.


alexknauth
2019-1-31 13:42:47

If the code is powerful enough (if it has macros which can manipulate scope), then yes you would have run some code. But not all of it! And in racket at least, the parts you would have to run-in-the-editor for scoping are specially marked for compile-time


alexknauth
2019-1-31 13:43:44

DrRacket does this with background-expansion, and its “check-syntax” arrows only work after that background-expansion has completed


alexknauth
2019-1-31 13:44:50

And you’re right that a macro might ruin that, either by taking too long, or trying to do something that wouldn’t be safe for the editor to run


wybitul.evzen
2019-1-31 13:45:04

It’s kinda sluggish, though. Not sure if it’s caused by the background expansion of the forms, but still.


alexknauth
2019-1-31 13:45:15

And that’s why that “third level” has to be separate from the other two


wybitul.evzen
2019-1-31 13:48:41

I wonder if the “stack machine” from Sublime could be implemented in VSCode as well. I heard Atom is pushing “tree-sitter” (not sure what it is, exactly, but supposedly better than plain regexps)… Maybe VSCode also has plans for some better way to make semantic highlighting possible? At least the first two levels


wybitul.evzen
2019-1-31 14:19:32

Anyway, what do you think about the colorization of the first symbol? I can drop it and only highlight the functions I know are exported from racket. But I’d have to highlight those wherever they appear, that means that (let ([map list]) (map add1 x)) and (compose (λ (x) (map add1 x)) range) won’t be differentiated, so some inconsistency will still be there.


d_run
2019-1-31 14:22:04



wybitul.evzen
2019-1-31 14:23:36

Just watched a video about it. Seems exactly what we were talking about. A real parser to be used for syntax highlighting


wybitul.evzen
2019-1-31 14:25:10

@d_run Any idea about the lame VSCode highlighting? :smile:


wybitul.evzen
2019-1-31 14:25:24

I mean. About the first symbols etc.


d_run
2019-1-31 14:26:14

VSCode does some pretty powerful highlighting of langs like TypeScript


d_run
2019-1-31 14:27:11

I haven’t lisped in VSCode tho, so not sure what that experience is like


githree
2019-1-31 14:28:15

silly question - wasn’t lang server protocol supposed to offer syntax highlighting as well?


d_run
2019-1-31 14:29:10

I thought thats what VSCode was doing with JS/TypeScript


wybitul.evzen
2019-1-31 14:30:00

Not sure how it works with TS, but I think they have some backend which they are querrying. Doesn’t seem to be universally usable (unlike tree sitter)


d_run
2019-1-31 14:30:17

Pretty sure they’re passing code to the TypeScript compiler


wybitul.evzen
2019-1-31 14:30:28

@githree It was/is. But afaik it’s not complete, and it’s slow and… Yeah. WIP.



wybitul.evzen
2019-1-31 14:31:13

Well, yeah. That’s along the lines of what I was thinking about. Not sure how I would do that with Racket; LSP would my safest bet I think.


d_run
2019-1-31 14:31:31

Racket Mode in Emacs does some fun along these lines


wybitul.evzen
2019-1-31 14:31:35

Once it works, that is.


wybitul.evzen
2019-1-31 14:32:09

Well, I didn’t do any emacsing on the lisp, to paraphrase you :smile:


d_run
2019-1-31 14:32:27

Right but it might illustrate an approach you could take


wybitul.evzen
2019-1-31 14:33:16

Sure. maybe it’d be best to help those guys with LSP, so it could then be reused in other editors as well.


githree
2019-1-31 14:33:29

the world where you specify language specific characteristics like syntax highlighting per language as opposed to current per editor would be a huge improvement, but well, seems like a long way ahead…


wybitul.evzen
2019-1-31 14:36:17

Yeah. Tree sitter could help that, as well as LSPs. I think we’re slowly getting there.


wybitul.evzen
2019-1-31 14:50:41

Does anybody here work on the LSP? I don’t have much experience with Racket, but I’m sure I could get into it.


andreiformiga
2019-1-31 14:53:36

@wybitul.evzen I’m interested in improving racket support in Atom, so I’ll definitely take a look at your VSCode plugin as well


githree
2019-1-31 14:55:15

I know there are 2 implementations so reaching their authors might be a good idea:


wybitul.evzen
2019-1-31 14:55:16

Well, unless you plan to implement it tree-sitter, we could join our forces on this one. The yaml can be easily converted to cson (at least I believe so)




wybitul.evzen
2019-1-31 14:56:02

I opened an issue on one of them. Didn’t think of there being two of them, though :smile:


wybitul.evzen
2019-1-31 14:56:14

Why does everything have to be so fragmented?


githree
2019-1-31 14:56:41

that’s a very good question…


githree
2019-1-31 14:57:08

I guess it’s a scheme heritage - everyone has their own


andreiformiga
2019-1-31 14:57:19

it’s an open source thing


andreiformiga
2019-1-31 14:57:46

if you look at the packages for VSCode or atom you’ll see lots of packages with similar funcionality


andreiformiga
2019-1-31 14:58:18

especially if it’s a simple package like a theme (I counted at least 3 zenburn theme packages for atom)


d_run
2019-1-31 14:59:14

have you looked at NPM lately?


wybitul.evzen
2019-1-31 14:59:22

That’s unfortunate.


d_run
2019-1-31 14:59:22

:joy:


wybitul.evzen
2019-1-31 15:00:32

It’s true that I built my syntax highliter from scratch as well… But initially I submitted a PR to one of the most popular packages for Racket, but without luck. So I resorted to making my own.


andreiformiga
2019-1-31 15:01:42

yes, that happens. you try to contact the maintainer and get no response


wybitul.evzen
2019-1-31 15:34:37

Well, it was more complicated than that. I contacted him, he responded, told me to make a PR, then accepted it and merged it; however, he didn’t update the package on the marketplace. I opened an issue about it and well… That has been well over 6 months ago.


andreiformiga
2019-1-31 15:41:23

it’s worse then


pocmatos
2019-1-31 16:00:40

I would like in scribble to be able to show a portion of a file in a column, possibly a function, and interactions using the function on the right side. Is there anything out there resembling helpers for this or something?


pocmatos
2019-1-31 16:15:19

… ok, i might be able to achieve the two column with a single-row, 2 column table.


sjaniska
2019-1-31 16:37:41

hello, is writing Racket with (neo)vim/DrRacket viable option?


sjaniska
2019-1-31 16:39:35

the other option which I consider is Julia lang


pocmatos
2019-1-31 16:41:38

neovim and drracket are two options to develop in racket.


pocmatos
2019-1-31 16:42:11

drracket has all the bells and whistles for racket dev. if you want to use neovim, take a look at https://docs.racket-lang.org/guide/Vim.html


sjaniska
2019-1-31 16:43:30

@pocmatos thanks. i’m asking since i’m not into Emacs..few tiems experienced slight wrist pain which never happened with vim


pocmatos
2019-1-31 16:45:13

understood. when i got wrist pain with emacs, I bought a new keyboard. but vim is also an option, although I have never used.


greg
2019-1-31 16:46:21

@sjaniska Some people like spacemacs, which configures Emacs to use many popular packages, one of which is evil-mode (vim modal editing bindings for emacs)


pocmatos
2019-1-31 16:46:25

ever since I started using “Microsoft Sculpt Ergonomic” keyboard+mouse set, pain disappeared. Emacs lives on in my machine. :slightly_smiling_face:


greg
2019-1-31 16:47:13

Other people like to remap the control and alt keys (some vim users like to do that for escape, too :))


greg
2019-1-31 16:47:43

I tend to use the standard bindings, but as a (bad) piano player I tend to use my thumb for ctrl and alt sometimes


greg
2019-1-31 16:48:31

Or you could do the simple thing and just use a vim :smile:


sjaniska
2019-1-31 16:48:39

heh, i’ve tried spacemacs, but it brings another layer on top of emacs and at that time it didn’t play well with e.g. gnus…now, i’m more int ovim-world - that’s why i’m asking…yeah, i keep caps & ctrl switched even with vim setup :slightly_smiling_face:


sjaniska
2019-1-31 16:49:27

@greg well, i’m just curious if there are racket/vim users :wink:


greg
2019-1-31 16:50:38

I think there are. But the people I know directly tend to use evil-mode with emacs (not necessarily the whole spacemacs thing, just evil-mode) as opposed to vim. That’s just the people I happen to know. ¯_(ツ)_/¯


sjaniska
2019-1-31 16:51:10

ok, got it


daniel
2019-1-31 16:51:50

I’m a new Racketeer but have used VIM for a couple of decades. So far it’s been fine using VIM. I’m not an IDE guy, so as convenient as Dr. Racket is, I still end up in VIM.


sjaniska
2019-1-31 16:54:13

@daniel thanks a lot. do you use vim or neovim?


sjaniska
2019-1-31 16:54:27

which plugins?


sjaniska
2019-1-31 16:56:10

so far, i’ve seen that Julia is nice with VIm, but i like Racket’s GUI support for writing desktop apps


daniel
2019-1-31 16:56:20

Plain old VIM with no plugins, so far. I usually SSH into a VPS, so an IDE is out of the question anyway. I just have a couple of panes open in tmux, one with VIM and in the other, the Racket REPL.


sjaniska
2019-1-31 16:57:10

ok


daniel
2019-1-31 16:58:29

Any language is nice with VIM. I wouldn’t go and use Julia just because of that. It ain’t no Lisp! :stuck_out_tongue:


sjaniska
2019-1-31 16:59:24

:joy:


daniel
2019-1-31 17:04:17

@pocmatos is right: This is a good resource to get you going with Racket in VIM: https://docs.racket-lang.org/guide/Vim.html


soegaard2
2019-1-31 20:46:30

@wybitul.evzen Great find (the pull request to fix brackets on Github (for Scheme)).


soegaard2
2019-1-31 20:46:51

I am attempting to find someone that can help in #textmate (on Freenode).


soegaard2
2019-1-31 20:49:58

@daniel Wrt IDEs: The most effort has gone into DrRacket and racket-mode in Emacs. It’s worth trying them out to see what they have to offer. If/when you return to Vim - you will know when to try something out in, say, DrRacket.


soegaard2
2019-1-31 21:02:27

@wybitul.evzen I have now also sent a mail to the Textmate mailing list.


wybitul.evzen
2019-1-31 21:03:23

Great. Maybe they will respond to that. I see to value in not adding the support for brackets.


wybitul.evzen
2019-1-31 21:04:13

(sent you a mail btw.)


soegaard2
2019-1-31 21:04:23

Still thinking!


soegaard2
2019-1-31 21:06:49

I think your option 2 is best. Highlight known identifiers bound to functions. It’s rare to rebind functions exported from the main language - and if it is done, it’s likely to be bound to another function.


wybitul.evzen
2019-1-31 21:07:30

Oh, no pressure. Just so you know! I’ve got a bit lost in our conversations myself, you know :smiley:


soegaard2
2019-1-31 21:08:25

But if you want to improve - you can copy the approach that racket-mode in Emacs uses.


soegaard2
2019-1-31 21:10:12

Hmm - well maybe not. Racket-mode also handles running / evaluating - so it has access the names being defined in the current module.


soegaard2
2019-1-31 21:11:11

But may be the lsp-server can be used instead?


wybitul.evzen
2019-1-31 22:21:16

Yep, we talked about this here. I contacted the maintainers of both of the LSP implementations. For the time being, textmate grammar is the best solution I’m afraid


githree
2019-1-31 22:34:50

Regarding IDEs do any of you have experience with https://www.theia-ide.org/


soegaard2
2019-1-31 22:36:17

Impressive.


githree
2019-1-31 22:36:18

I like their approach and just found out they are building support for VS Code extensions which will make it a great choice especially if you want to build your own custom IDE


githree
2019-1-31 22:42:15

wybitul.evzen
2019-1-31 22:58:16

Looks nice. The dev of this particular lsp said he doesn’t work on the project (the LSP, that is) anymore.


githree
2019-1-31 23:57:56

I wonder is it possible with LSP to expose the information used by custom Racket DSLs (and not only #lang racket)


githree
2019-2-1 00:01:24

what I mean by that is if my DSL has DrRacket integration (e.g. coloring) could this information be automatically exposed via LSP?


samth
2019-2-1 01:58:42

@githree yes that should be possible