Giter Club home page Giter Club logo

Comments (8)

pfitzseb avatar pfitzseb commented on September 28, 2024 2

Yeah, turns out I only committed the changelog entry in that PR. Should actually be fixed with #252.

from atom-language-julia.

Alhadis avatar Alhadis commented on September 28, 2024 2

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.

Alhadis avatar Alhadis commented on September 28, 2024 1

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.

jeremiahpslewis avatar jeremiahpslewis commented on September 28, 2024

This seems like it still is an issue and may need to be reopened, example here.

from atom-language-julia.

jeremiahpslewis avatar jeremiahpslewis commented on September 28, 2024

(Ref: github-linguist/linguist#5637)

from atom-language-julia.

jeremiahpslewis avatar jeremiahpslewis commented on September 28, 2024

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.

jeremiahpslewis avatar jeremiahpslewis commented on September 28, 2024

PR is here for reference: github-linguist/linguist#5638

from atom-language-julia.

pfitzseb avatar pfitzseb commented on September 28, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.