Closed Bug 572115 Opened 10 years ago Closed 9 years ago

Ability to highlight different kinds of modules being imported


(Skywriter Graveyard :: Syntax Highlighting, defect)

Not set


(Not tracked)



(Reporter: dangoor, Assigned: pcwalton)



(Whiteboard: [FlightDeck] [goals])

From dbuchner:

One thing that we would like to have for FlightDeck is the ability syntax highlight special chunks of code that related to the module system and Jetpack specifically, here are a few examples:

requires(__) - if the required module is an official module, maybe we want to show green colored text, if it is a community generated, unofficial module, then perhaps blue, etc.


I remember syntax highlighting being a feature of pre-0.8 Bespin, but does it have space for adding deeper logic to it as shown in the first 'requires' example above?


We need to drill into exactly what the definition of an "official module" is, but this seems doable.
Whiteboard: [FlightDeck] → [FlightDeck] [goals]
This is possible, but not in the "standard" syntax engine. Fortunately, we now have Narcissus' lexer available, so this should be doable. It will require rewiring and retesting the JavaScript syntax engine.
It's worth noting that this is for Q3.
Depends on: 572263
Complexity of this is dependent on how complete we want the feature to be. For the case of embedded Bespin, such as FlightDeck, where the embedder supplies a fixed list of known modules and the colors to highlight each one with, this should be easy (an afternoon of hacking, maybe). For hosted Bespin, where the user can configure per-project settings to this effect, it would be more difficult. Handling edge cases would also be difficult (e.g. require("jet" + "pack");, but I think we can do without them.)
I believe that require("jet" + "pack") is actually not legal CommonJS syntax (the stuff inside require() is supposed to be statically analyzable).

Given that the prime user of this is FlightDeck, I think the simple solution will suffice. cc'ing dbuchner to be sure about that.
Blocks: devtools924
Closed: 9 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.