Skip to content

Highlight all CML keywords of the grammar - #49

Open
stefan-ka wants to merge 1 commit into
masterfrom
fix/highlighting-keywords
Open

stefan-ka wants to merge 1 commit into
masterfrom
fix/highlighting-keywords

Conversation

@stefan-ka

Copy link
Copy Markdown
Member

The CML syntax highlighting only knew part of the language. Its keyword list is now generated from the Xtext grammars of the DSL (ContextMappingDSL.xtext, TacticDDDLanguage.xtext on master), so it matches the Rouge lexer on the website (contextmapper.github.io#111).

Changes

  • Missing keywords added (30 grammar keywords plus the enum values), e.g. ApplicationPart, TacticDDDApplication, persistent, inject, groupBy, orderBy, databaseJoinTable, NORMAL, RARELY, OFTEN, HUGE, TINY, GENESIS, COMMODITY.
  • Multi-word keywords are matched as a whole: read-only used to show up as read plus -only; initiated by, In the context of the SOI,, stakeholders expect it to promote, protect or create and with the following externally observable and/or internally auditable behavior: were never matched completely.
  • Entries that aren't CML keywords are removed: true, subscribe to (the grammar has subscribe … to), and the broken parts of the multi-word keywords above.
  • Built-in types (String, int, List, …) get the support.type.cml scope, so themes can colour them differently from keywords.
  • The line comment scope is now comment.line.double-slash.cml (it was double-dash).

Verification

I tokenized all 315 .cml files of the DSL repo with vscode-textmate and vscode-oniguruma, using the old and the new grammar. Every token that was highlighted before still is, either as a keyword or, for the types, as support.type. The only additions are the keywords listed above. I also tested the multi-word Value Register keywords with a separate file.

#44 and #45 add nonResponsibilities and Invariant to the old lists. After this is merged I'll rebase them so that each adds its keyword to the new list.

The keyword list of the CML syntax highlighting is now generated from the
Xtext grammars of the DSL (ContextMappingDSL.xtext, TacticDDDLanguage.xtext),
the same list the Rouge lexer of the website uses. Keywords that were missing
(e.g. ApplicationPart, read-only, initiated by, persistent, the enum values
NORMAL, RARELY, OFTEN, HUGE, TINY) are highlighted now; multi-word keywords
are matched as a whole and the built-in types use their own scope
(support.type.cml).

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant