Comments (8)
Yeah, turns out I only committed the changelog entry in that PR. Should actually be fixed with #252.
from atom-language-julia.
Pro-tip: When embedding third-party grammars (particularly those you have no control over), it's always prudent to use a fixed-size pattern rather than a begin
/end
pair; i.e., thisβ¦
name: "string.quoted.double.julia"
match: '(")((?:[^"\\\\]|\\\\.)*+)(")'
captures:
1: name: "punctuation.definition.string.begin.julia"
2: name: "text.embedded.md", patterns: [include: "text.md"]
3: name: "punctuation.definition.string.end.julia"
β¦ instead of this:
name: "string.quoted.double.julia"
begin: '"'
end: '"'
beginCaptures: 0: name: "punctuation.definition.string.begin.julia"
endCaptures: 0: name: "punctuation.definition.string.end.julia"
contentName: "text.embedded.md"
patterns: [include: "text.md"]
I call this technique "clamping", because patterns that would otherwise threaten to spill past the end
pattern (and ruin the document's highlighting) are confined to an existing capture group. The trade-off is that it isn't possible to embed multiline patterns this way, but that's a pretty sane trade-off when the alternative is screwing with the entire document.
from atom-language-julia.
Do you have any ideas for multi-line strings, short of removing those rules?
Yes, though it's a little trickier:
name: "string.quoted.double.julia"
begin: '"'
end: '"'
beginCaptures: 0: name: "punctuation.definition.string.begin.julia"
endCaptures: 0: name: "punctuation.definition.string.end.julia"
patterns: [{
name: "text.embedded.md"
match: '(?:[^"\\\\]|\\\\.)*+'
captures:
0: patterns: [include: "text.md"]
}]
from atom-language-julia.
This seems like it still is an issue and may need to be reopened, example here.
from atom-language-julia.
(Ref: github-linguist/linguist#5637)
from atom-language-julia.
Hahaha, shame on me for believing the release notes ;) Can you tag a new version so I can annoy github about updating linguist? Just saw 0.22.0. Thanks!
from atom-language-julia.
PR is here for reference: github-linguist/linguist#5638
from atom-language-julia.
Thanks, that's a great solution. Do you have any ideas for multi-line strings, short of removing those rules?
from atom-language-julia.
Related Issues (20)
- Transpose operator (') breaks syntax highlighting on GitHub HOT 2
- Braces in type parameters break highlighting for the whole file
- `β²` breaks variable syntax highlighting
- md"a" syntax breaks highlighting
- Tokenize TODO in comments HOT 3
- Make more specific token for `::` HOT 4
- Weird case of function tokenization when end of line comment includes parentheses HOT 1
- colored documentation syntax as comment HOT 1
- Highlight attributes of a module or constructor HOT 4
- Incorrect syntax highlighting when splatting a range
- Unicode operators aren't highlighted HOT 1
- Additional keywords HOT 1
- String interpolation with generator is broken HOT 3
- Unicode letters break type name HOT 1
- Command interpolation
- Syntax coloring for doctests
- New `public` keyword not recognized
- Future development after Atom's sunset HOT 1
- Tokenization of commas changed to `source.julia`, which affects Julia Color Themes HOT 8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from atom-language-julia.