Codeless Language Module design question.

89 views
Skip to first unread message

Christopher Waterman

unread,
Aug 14, 2021, 10:56:58 PM8/14/21
to bbe...@googlegroups.com
I couldn’t find a Language Module for Fish Shell so a put one together last night.
It works, but I have a design question.

In order to make the BBLMKeywordList & BBLMPredefinedNameList

I made a list of the built-in commands from here: https://fishshell.com/docs/current/commands.html

Then pulled out the ones I think belong in the BBLMKeywordList.

<key>BBLMKeywordList</key>
<array>
<string>function</string>
<string>end</string>
<string>if</string>
<string>else</string>
<string>for</string>
<string>while</string>
<string>switch</string>
<string>case</string>
<string>begin</string>
<string>command</string>
<string>continue</string>
<string>return</string>
<string>break</string>
<string>exit</string>
<string>true</string>
<string>false</string>
<string>and</string>
<string>or</string>
<string>not</string>
<string>in</string>
<string>|</string>
<string>&amp;</string>
</array>
Then I printed “ls /bin” to BBEdit to make a third list.
I removed duplicates and felt like I ended up with a pretty good list of the most general unix commands.

Something like this but longer:

<key>BBLMPredefinedNameList</key>
<array>
<!-- Built-in Fish commands minus /bin and those used in BBLKeywordList -->

<string>_</string>
<string>abbr</string>
<string>alias</string>
<string>argparse</string>
<string>bg</string>
<string>bind</string>
<string>block</string>
<string>breakpoint</string>
<string>builtin</string>
<string>cd</string>
… 
…the list continues

<!-- List from /bin -->

<string>bash</string>
<string>cat</string>
<string>chmod</string>
<string>cp</string>
<string>csh</string>
<string>dash</string>
<string>date</string>
… 
…the list continues
<array>
Should I have left out the commands from /bin? Is there more utility in highlighting only the built-in commands?
I know this isn’t a very technical question, nor particularly important, but I’m curious what this crowd might think.

Thanks
—Chris







list....@munkynet.org

unread,
Aug 15, 2021, 12:21:11 PM8/15/21
to BBEdit Talk
Chris,

I've also made my own CLM for Fish. Instead of using
BBLMPredefinedNameList for as additional commands, I'm using it for
"special" variables: PATH, fish_greeting, fish_color_*, etc. Basically
everything listed here:
https://fishshell.com/docs/current/language.html#special-variables

(Fish is a little slippery about the concept of special variables. Some
variables listed there are used by the shell itself, while others are
only used by scripts bundled with the shell. I'm not sure the distinction
is terribly important.)

Hope this helps.
-sam

*From: *Christopher Waterman <ch...@rustydogink.com>
*To: *bbe...@googlegroups.com
*Date: *Aug 14, 2021 10:56:59 PM
*Subject: *Codeless Language Module design question.

Darren Duncan

unread,
Aug 15, 2021, 1:12:11 PM8/15/21
to bbe...@googlegroups.com
Something I will say is that while I've found the codeless language module
functionality very helpful, and I have written and maintain a few of my own, I
have also, perhaps partly due to ignorance, ran into their limitations quite a bit.

I really appreciate BBEdit's new support for language servers, and when I'm able
to, intend to re-implement some codeless language modules as servers for that
protocol, helping them be much more capable in the process.

I could be wrong but I get the impression that older methods of language support
are now deprecated in favor of the new language protocol, as it can benefit from
economies of scale to get maintained support for a lot more languages.

-- Darren Duncan
> --
> This is the BBEdit Talk public discussion group. If you have a feature request
> or need technical support, please email "sup...@barebones.com" rather than
> posting here. Follow @bbedit on Twitter: <https://twitter.com/bbedit
> <https://twitter.com/bbedit>>
> ---
> You received this message because you are subscribed to the Google Groups
> "BBEdit Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an email
> to bbedit+un...@googlegroups.com <mailto:bbedit+un...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/bbedit/D75B10C1-AB11-467C-830D-39B3CB061D42%40rustydogink.com
> <https://groups.google.com/d/msgid/bbedit/D75B10C1-AB11-467C-830D-39B3CB061D42%40rustydogink.com?utm_medium=email&utm_source=footer>.

Christopher Waterman

unread,
Aug 16, 2021, 11:44:37 PM8/16/21
to bbe...@googlegroups.com
Sam

I think that is really smart.
> --
> This is the BBEdit Talk public discussion group. If you have a feature request or need technical support, please email "sup...@barebones.com" rather than posting here. Follow @bbedit on Twitter: <https://twitter.com/bbedit>
> --- You received this message because you are subscribed to the Google Groups "BBEdit Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to bbedit+un...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/bbedit/a5881ade-376c-4531-96b8-c8d48f909fca%40munkynet.org.

Christopher Waterman

unread,
Aug 17, 2021, 12:29:04 AM8/17/21
to bbe...@googlegroups.com
Darren,

I bumped up against the limitation of the CLM’s as well. Language Server Protocol support is really a big deal.

But I think built in support for languages will continue for a very long time. Outside the pedantic notion that you have to have some language support in order to connect to the servers. Editor makers will want to do things not provided by LSP. I suspect that if they add more features to LSP different editors will support different sets and choose to roll their own feature in other cases. Its a competitive market with free options, there is a lot of pressure to stand out.

BBEdit doesn’t use it for syntax coloring now, and I wouldn’t be surprised if they have no plans too. I’m speculating but I think the situation with the coded vs codeless modules is a product of Bare Bones protecting BBEdits performance (I think syntax coloring like HTML rendering is surprisingly processor intensive). One is very limited but trivial to write, the other is difficult but extremely flexible. Both are fast. If Rich sees that speed as key to his customers no way he hands that over to a gallery of third parties.

Also what if no one writes a LS for say Fish (there might be one, I don’t know). I banged that CLM out in an hour, it was my first one, and I am not a good programmer.

I hadn’t really thought about the future of this. So thanks, now I’m kind of excited to see how this plays out.

—Chris

Darren Duncan

unread,
Aug 17, 2021, 9:27:45 AM8/17/21
to bbe...@googlegroups.com
Unless I'm confused, I had thought Language Server Protocol was the new big
standard created recently and used by Visual Studio Code and other popular
editors or IDEs and that it was intended to support all the usual features of a
language that an editor would care about, including all the syntax coloring and
function scanning and delimiter pair folding and so on. -- Darren Duncan

Sam Birch

unread,
Aug 17, 2021, 5:08:58 PM8/17/21
to bbe...@googlegroups.com
LSP does have facilities for helping editors out with syntax highlighting. Skimming the spec, I found:

https://microsoft.github.io/language-server-protocol/specifications/specification-3-16/#textDocument_semanticTokens

“The request is sent from the client to the server to resolve semantic tokens for a given file. Semantic tokens are used to add additional color information to a file that depends on language specific symbol information. A semantic token request usually produces a large result. The protocol therefore supports encoding tokens with numbers. In addition optional support for deltas is available.”

This looks painful to implement, but I’m guessing it could be “smarter” than a CLM when dealing with languages with weird grammars. It’s also brand new in the current version of the LSP spec, so I can’t imagine that it’s widely supported by servers yet.

Cheers,
-sam
> --
> This is the BBEdit Talk public discussion group. If you have a feature request or need technical support, please email "sup...@barebones.com" rather than posting here. Follow @bbedit on Twitter: <https://twitter.com/bbedit>
> --- You received this message because you are subscribed to the Google Groups "BBEdit Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to bbedit+un...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/bbedit/e6d9da6e-6f59-85b8-c6d5-1ba33c13abd2%40darrenduncan.net.
Reply all
Reply to author
Forward
0 new messages