[SERVER-2767] Syntax highlighting in shell Created: 16/Mar/11  Updated: 10/May/22

Status: Backlog
Project: Core Server
Component/s: Shell
Affects Version/s: None
Fix Version/s: None

Type: New Feature Priority: Trivial - P5
Reporter: MattK Assignee: Massimiliano Marcon
Resolution: Unresolved Votes: 6
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Participants:

 Description   

Basic javascript syntax highlighting with bracket matching would be useful in the console, especially when entering nested braces. Of all the colorization various text editors perform, highlighting the current matched brace or paren can be one of the more timesaving features in resolving syntax errors.



 Comments   
Comment by Steven Vannelli [ 10/May/22 ]

Moving this ticket to the Backlog and removing the "Backlog" fixVersion as per our latest policy for using fixVersions.

Comment by Pavel Sprogis [ 26/Sep/14 ]

It would be great to add syntax highlighting in mongo shell as soon as possible. mongo-hacker has nice highlighting but they add a lot of trash: change default methods behaviour, change prototypes, add a lot of methods in global scope, etc. And all I need is just colorizer. Is it possible to increase priority/severity of this improvment ?

Comment by Alexander Czar Sarkisov [ 28/Aug/14 ]

There is an interesting mongo-hacker project which extends mongo shell. Among other features it provides json highlighting of documents. You may try to post a request for this feature there or fork and extend the project yourself.

Comment by Tad Marshall [ 16/Apr/12 ]

The current brace-matching logic is too generous in highlighting "matching" braces and will highlight a "(" when you move the cursor over a "]". The code should highlight only correct matches. For extra credit, it could also highlight incorrect matches in a different color, e.g. red.

Comment by MattK [ 06/Mar/12 ]

I have not had the chance to test the new versions yet, nor am I a Visual Studio user (any more), but highlighting both sounds useful. IIRC when entering this issue, I was working with nested docs, and matching braces on the shell was the source of more than one error on my part.

Comment by Tad Marshall [ 06/Mar/12 ]

Have you tried what we have in current versions – 2.0.3 and 2.1.0? It highlights the matching brace as you move the cursor left and right. It highlights only the matching one when the cursor is over a brace/bracket/parenthesis ... Visual Studio highlights both the one you are on and the matching one. Is the current feature good, should we add the Visual Studio behavior, or is there something else you are looking for?

Thanks!

Comment by MattK [ 06/Mar/12 ]

Brace matching was the motivation behind the request. Keyword highlighting would be a nice feature as well, but not as important as pairing braces visually.

Comment by Tad Marshall [ 06/Mar/12 ]

We do limited brace matching now ... move the cursor over a brace or parenthesis and it will color the matching one ... but I'm not sure what people are looking for here. Syntax coloring of JavaScript keywords is probably not a quick feature if that is what this ticket means. Indenting based on counting unmatched braces is probably doable.

Comment by Mathias Stearn [ 04/Aug/11 ]

Yes, but there is a chance it will get pulled before 2.0. in the 1.9 shells we already highlight matching braces.

Comment by Tianon Gravi [ 12/Jul/11 ]

I noticed some commits in https://github.com/mongodb/mongo/commits/master recently that addressed some issues with bracket highlighting; does that mean this is at least partially in-progress?

Comment by Andrew Armstrong [ 16/Mar/11 ]

Agreed. One extra minor feature too would be nested indenting when you type { and go to a new line. Currently you only indent at most one level (even if you then open another brace), it would be neat if it kept indenting as expected.

Generated at Thu Feb 08 03:01:08 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.