Skip to content

Commit

Permalink
CM fix
Browse files Browse the repository at this point in the history
  • Loading branch information
breck7 committed Nov 21, 2024
1 parent 64f74cb commit 1449ba4
Show file tree
Hide file tree
Showing 8 changed files with 42 additions and 24 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "scrollsdk",
"version": "95.0.0",
"version": "95.0.1",
"description": "This npm package includes the Particles class, the Parsers compiler-compiler, a Parsers IDE, and more, all implemented in Particles, Parsers, and TypeScript.",
"types": "./built/scrollsdk.node.d.ts",
"main": "./products/Particle.js",
Expand Down
21 changes: 13 additions & 8 deletions parsers/ParsersCodeMirrorMode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -360,14 +360,19 @@ class ParsersCodeMirrorMode {
}

private _getAtomStyle(lineIndex: particlesTypes.int, atomIndex: particlesTypes.int): string {
const program = this._getParsedProgram()

// todo: if the current atom is an error, don't show red?
if (!program.getAtomPaintAtPosition) console.log(program)
const paint = program.getAtomPaintAtPosition(lineIndex, atomIndex)
const style = paint ? <string>textMateScopeToCodeMirrorStyle(paint.split(".")) : undefined

return style || "noPaintDefinedInParsers"
try {
const program = this._getParsedProgram()

// todo: if the current atom is an error, don't show red?
if (!program.getAtomPaintAtPosition) console.log(program)
const paint = program.getAtomPaintAtPosition(lineIndex, atomIndex)
const style = paint ? <string>textMateScopeToCodeMirrorStyle(paint.split(".")) : undefined

return style || "noPaintDefinedInParsers"
} catch (err) {
console.error(err)
return "noPaintDefinedInParsers"
}
}

// todo: remove.
Expand Down
2 changes: 1 addition & 1 deletion particle/Particle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3094,7 +3094,7 @@ class Particle extends AbstractParticle {
return str ? indent + str.replace(/\n/g, indent) : ""
}

static getVersion = () => "95.0.0"
static getVersion = () => "95.0.1"

static fromDisk(path: string): Particle {
const format = this._getFileFormat(path)
Expand Down
17 changes: 11 additions & 6 deletions products/ParsersCodeMirrorMode.browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -317,12 +317,17 @@ class ParsersCodeMirrorMode {
return style
}
_getAtomStyle(lineIndex, atomIndex) {
const program = this._getParsedProgram()
// todo: if the current atom is an error, don't show red?
if (!program.getAtomPaintAtPosition) console.log(program)
const paint = program.getAtomPaintAtPosition(lineIndex, atomIndex)
const style = paint ? textMateScopeToCodeMirrorStyle(paint.split(".")) : undefined
return style || "noPaintDefinedInParsers"
try {
const program = this._getParsedProgram()
// todo: if the current atom is an error, don't show red?
if (!program.getAtomPaintAtPosition) console.log(program)
const paint = program.getAtomPaintAtPosition(lineIndex, atomIndex)
const style = paint ? textMateScopeToCodeMirrorStyle(paint.split(".")) : undefined
return style || "noPaintDefinedInParsers"
} catch (err) {
console.error(err)
return "noPaintDefinedInParsers"
}
}
// todo: remove.
startState() {
Expand Down
17 changes: 11 additions & 6 deletions products/ParsersCodeMirrorMode.js
Original file line number Diff line number Diff line change
Expand Up @@ -318,12 +318,17 @@ class ParsersCodeMirrorMode {
return style
}
_getAtomStyle(lineIndex, atomIndex) {
const program = this._getParsedProgram()
// todo: if the current atom is an error, don't show red?
if (!program.getAtomPaintAtPosition) console.log(program)
const paint = program.getAtomPaintAtPosition(lineIndex, atomIndex)
const style = paint ? textMateScopeToCodeMirrorStyle(paint.split(".")) : undefined
return style || "noPaintDefinedInParsers"
try {
const program = this._getParsedProgram()
// todo: if the current atom is an error, don't show red?
if (!program.getAtomPaintAtPosition) console.log(program)
const paint = program.getAtomPaintAtPosition(lineIndex, atomIndex)
const style = paint ? textMateScopeToCodeMirrorStyle(paint.split(".")) : undefined
return style || "noPaintDefinedInParsers"
} catch (err) {
console.error(err)
return "noPaintDefinedInParsers"
}
}
// todo: remove.
startState() {
Expand Down
2 changes: 1 addition & 1 deletion products/Particle.browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -2598,7 +2598,7 @@ Particle.iris = `sepal_length,sepal_width,petal_length,petal_width,species
4.9,2.5,4.5,1.7,virginica
5.1,3.5,1.4,0.2,setosa
5,3.4,1.5,0.2,setosa`
Particle.getVersion = () => "95.0.0"
Particle.getVersion = () => "95.0.1"
class AbstractExtendibleParticle extends Particle {
_getFromExtended(cuePath) {
const hit = this._getParticleFromExtended(cuePath)
Expand Down
2 changes: 1 addition & 1 deletion products/Particle.js
Original file line number Diff line number Diff line change
Expand Up @@ -2588,7 +2588,7 @@ Particle.iris = `sepal_length,sepal_width,petal_length,petal_width,species
4.9,2.5,4.5,1.7,virginica
5.1,3.5,1.4,0.2,setosa
5,3.4,1.5,0.2,setosa`
Particle.getVersion = () => "95.0.0"
Particle.getVersion = () => "95.0.1"
class AbstractExtendibleParticle extends Particle {
_getFromExtended(cuePath) {
const hit = this._getParticleFromExtended(cuePath)
Expand Down
3 changes: 3 additions & 0 deletions releaseNotes.scroll
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ node_modules/scroll-cli/microlangs/changes.parsers

thinColumns 4

📦 95.0.1 2024-11-21
🏥 don't crash codemirror if error in parsers

📦 95.0.0 2024-11-19
🎉 Parsers autocomplete cleanup
⚠️ BREAKING: (no one should be affected) removed unused extensions and compilesTo parsers in Parsers
Expand Down

0 comments on commit 1449ba4

Please sign in to comment.