diff --git a/.eslintignore b/.eslintignore index f06202dbaa1..07851a60c2f 100644 --- a/.eslintignore +++ b/.eslintignore @@ -21,4 +21,5 @@ demo/ api/ **/* * **/node_modules -0* \ No newline at end of file +0* +esm-resolver.js \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/add-to-website.yml b/.github/ISSUE_TEMPLATE/add-to-website.yml index 99573b72525..f8e865915bc 100644 --- a/.github/ISSUE_TEMPLATE/add-to-website.yml +++ b/.github/ISSUE_TEMPLATE/add-to-website.yml @@ -1,51 +1,51 @@ ---- -name: "🌐 Add a project to the list of project using Ace on its website." -description: Add a project to the list of projects using Ace, displayed on the website. -title: "Add project (project name) to the list of projects using Ace on its website" -labels: [website, needs-triage] -assignees: [] -body: - - type: markdown - attributes: - value: | - The fastest way to get your project to be displayed on the website is to create a PR. - Examples: https://github.com/ajaxorg/ace/pull/5014, https://github.com/ajaxorg/ace/pull/5222. - If for any reason creating a PR is not an option for you, please proceed with filling out this issue. Thanks! - - type: input - id: name - attributes: - label: Project name - description: A name of the project to be used on Ace website. - validations: - required: true - - type: input - id: project-link - attributes: - label: Project link - description: A link to the project's website. - validations: - required: true - - type: input - id: logo-link - attributes: - label: Logo link - description: | - A link to the logo image to be used on the website for the project. If not provided, only the name of the project will be displayed. - - By submitting this link, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice. - validations: - required: false - - type: textarea - id: info - attributes: - label: Additional information - description: Any additional information you would like to share. - validations: - required: false - - type: checkboxes - id: ack - attributes: - label: Acknowledgements - options: - - label: I may be able to implement this request. - required: false +--- +name: "🌐 Add a project to the list of project using Ace on its website." +description: Add a project to the list of projects using Ace, displayed on the website. +title: "Add project (project name) to the list of projects using Ace on its website" +labels: [website, needs-triage] +assignees: [] +body: + - type: markdown + attributes: + value: | + The fastest way to get your project to be displayed on the website is to create a PR. + Examples: https://github.com/ajaxorg/ace/pull/5014, https://github.com/ajaxorg/ace/pull/5222. + If for any reason creating a PR is not an option for you, please proceed with filling out this issue. Thanks! + - type: input + id: name + attributes: + label: Project name + description: A name of the project to be used on Ace website. + validations: + required: true + - type: input + id: project-link + attributes: + label: Project link + description: A link to the project's website. + validations: + required: true + - type: input + id: logo-link + attributes: + label: Logo link + description: | + A link to the logo image to be used on the website for the project. If not provided, only the name of the project will be displayed. + + By submitting this link, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice. + validations: + required: false + - type: textarea + id: info + attributes: + label: Additional information + description: Any additional information you would like to share. + validations: + required: false + - type: checkboxes + id: ack + attributes: + label: Acknowledgements + options: + - label: I may be able to implement this request. + required: false diff --git a/Makefile.dryice.js b/Makefile.dryice.js index 5c4eeaef012..e0d138f0988 100755 --- a/Makefile.dryice.js +++ b/Makefile.dryice.js @@ -312,7 +312,7 @@ function demo() { source = source.replace(/( |^)require\(/gm, "$1ace.require("); } source = source.replace(/"\.\.\/build\//g, function(e) { - console.log(e); return '"../'; + return '"../'; }); return source; } @@ -668,7 +668,6 @@ function extractCss(callback) { else imageName = name + "-" + imageCounter + ".png"; images[imageName] = buffer; - console.log("url(\"" + directory + "/" + imageName + "\")"); return "url(\"" + directory + "/" + imageName + "\")"; } ); diff --git a/demo/kitchen-sink/docs/abc.abc b/demo/kitchen-sink/docs/abc.abc index d8ac326efb4..e6683c3d67c 100644 --- a/demo/kitchen-sink/docs/abc.abc +++ b/demo/kitchen-sink/docs/abc.abc @@ -1,171 +1,171 @@ -%abc-2.1 -H:This file contains some example English tunes -% note that the comments (like this one) are to highlight usages -% and would not normally be included in such detail -O:England % the origin of all tunes is England - -X:1 % tune no 1 -T:Dusty Miller, The % title -T:Binny's Jig % an alternative title -C:Trad. % traditional -R:DH % double hornpipe -M:3/4 % meter -K:G % key -B>cd BAG|FA Ac BA|B>cd BAG|DG GB AG:| -Bdd gfg|aA Ac BA|Bdd gfa|gG GB AG:| -BG G/2G/2G BG|FA Ac BA|BG G/2G/2G BG|DG GB AG:| -W:Hey, the dusty miller, and his dusty coat; -W:He will win a shilling, or he spend a groat. -W:Dusty was the coat, dusty was the colour; -W:Dusty was the kiss, that I got frae the miller. - -X:2 -T:Old Sir Simon the King -C:Trad. -S:Offord MSS % from Offord manuscript -N:see also Playford % reference note -M:9/8 -R:SJ % slip jig -N:originally in C % transcription note -K:G -D|GFG GAG G2D|GFG GAG F2D|EFE EFE EFG|A2G F2E D2:| -D|GAG GAB d2D|GAG GAB c2D|[1 EFE EFE EFG|[A2G] F2E D2:|\ % no line-break in score -M:12/8 % change of meter -[2 E2E EFE E2E EFG|\ % no line-break in score -M:9/8 % change of meter -A2G F2E D2|] - -X:3 -T:William and Nancy -T:New Mown Hay -T:Legacy, The -C:Trad. -O:England; Gloucs; Bledington % place of origin -B:Sussex Tune Book % can be found in these books -B:Mally's Cotswold Morris vol.1 2 -D:Morris On % can be heard on this record -P:(AB)2(AC)2A % play the parts in this order -M:6/8 -K:G -[P:A] D|"G"G2G GBd|"C"e2e "G"dBG|"D7"A2d "G"BAG|"C"E2"D7"F "G"G2:| -[P:B] d|"G"e2d B2d|"C"gfe "G"d2d| "G"e2d B2d|"C"gfe "D7"d2c| - "G"B2B Bcd|"C"e2e "G"dBG|"D7"A2d "G"BAG|"C"E2"D7"F "G"G2:| -% changes of meter, using inline fields -[T:Slows][M:4/4][L:1/4][P:C]"G"d2|"C"e2 "G"d2|B2 d2|"Em"gf "A7"e2|"D7"d2 "G"d2|\ - "C"e2 "G"d2|[M:3/8][L:1/8] "G"B2 d |[M:6/8] "C"gfe "D7"d2c| - "G"B2B Bcd|"C"e2e "G"dBG|"D7"A2d "G"BAG|"C"E2"D7"F "G"G2:| - -X:4 -T:South Downs Jig -R:jig -S:Robert Harbron -M:6/8 -L:1/8 -K:G -|: d | dcA G3 | EFG AFE | DEF GAB | cde d2d | -dcA G3 | EFG AFE | DEF GAB | cAF G2 :| -B | Bcd e2c | d2B c2A | Bcd e2c | [M:9/8]d2B c2B A3 | -[M:6/8]DGF E3 | cBA FED | DEF GAB |1 cAF G2 :|2 cAF G3 |] - -X:5 -T:Atholl Brose -% in this example, which reproduces Highland Bagpipe gracing, -% the large number of grace notes mean that it is more convenient to be specific about -% score line-breaks (using the $ symbol), rather than using code line breaks to indicate them -I:linebreak $ -K:D -{gcd}c<{e}A {gAGAG}A2 {gef}e>A {gAGAG}Ad| -{gcd}c<{e}A {gAGAG}A>e {ag}a>f {gef}e>d| -{gcd}c<{e}A {gAGAG}A2 {gef}e>A {gAGAG}Ad| -{g}c/d/e {g}G>{d}B {gf}gG {dc}d>B:|$ -{g}ce {ag}a>e {gf}g>e| -{g}ce {ag}a2 {GdG}a>d| -{g}ce {ag}a>e {gf}g>f| -{gef}e>d {gf}g>d {gBd}B<{e}G {dc}d>B| -{g}ce {ag}a>e {gf}g>e| -{g}ce {ag}a2 {GdG}ad| -{g}c<{GdG}e {gf}ga {f}g>e {g}f>d| -{g}e/f/g {Gdc}d>c {gBd}B<{e}G {dc}d2|] - -X:6 -T:Untitled Reel -C:Trad. -K:D -eg|a2ab ageg|agbg agef|g2g2 fgag|f2d2 d2:|\ -ed|cecA B2ed|cAcA E2ed|cecA B2ed|c2A2 A2:| -K:G -AB|cdec BcdB|ABAF GFE2|cdec BcdB|c2A2 A2:| - -X:7 -T:Kitchen Girl -C:Trad. -K:D -[c4a4] [B4g4]|efed c2cd|e2f2 gaba|g2e2 e2fg| -a4 g4|efed cdef|g2d2 efed|c2A2 A4:| -K:G -ABcA BAGB|ABAG EDEG|A2AB c2d2|e3f edcB|ABcA BAGB| -ABAG EGAB|cBAc BAG2|A4 A4:| - -%abc-2.1 -%%pagewidth 21cm -%%pageheight 29.7cm -%%topspace 0.5cm -%%topmargin 1cm -%%botmargin 0cm -%%leftmargin 1cm -%%rightmargin 1cm -%%titlespace 0cm -%%titlefont Times-Bold 32 -%%subtitlefont Times-Bold 24 -%%composerfont Times 16 -%%vocalfont Times-Roman 14 -%%staffsep 60pt -%%sysstaffsep 20pt -%%musicspace 1cm -%%vocalspace 5pt -%%measurenb 0 -%%barsperstaff 5 -%%scale 0.7 -X: 1 -T: Canzonetta a tre voci -C: Claudio Monteverdi (1567-1643) -M: C -L: 1/4 -Q: "Andante mosso" 1/4 = 110 -%%score [1 2 3] -V: 1 clef=treble name="Soprano"sname="A" -V: 2 clef=treble name="Alto" sname="T" -V: 3 clef=bass middle=d name="Tenor" sname="B" -%%MIDI program 1 75 % recorder -%%MIDI program 2 75 -%%MIDI program 3 75 -K: Eb -% 1 - 4 -[V: 1] |:z4 |z4 |f2ec |_ddcc | -w: Son que-sti~i cre-spi cri-ni~e -w: Que-sti son gli~oc-chi che mi- -[V: 2] |:c2BG|AAGc|(F/G/A/B/)c=A|B2AA | -w: Son que-sti~i cre-spi cri-ni~e que - - - - sto~il vi-so e -w: Que-sti son~gli oc-chi che mi-ran - - - - do fi-so mi- -[V: 3] |:z4 |f2ec|_ddcf |(B/c/_d/e/)ff| -w: Son que-sti~i cre-spi cri-ni~e que - - - - sto~il -w: Que-sti son~gli oc-chi che mi-ran - - - - do -% 5 - 9 -[V: 1] cAB2 |cAAA |c3B|G2!fermata!Gz ::e4| -w: que-sto~il vi-so ond' io ri-man-go~uc-ci-so. Deh, -w: ran-do fi-so, tut-to re-stai con-qui-so. -[V: 2] AAG2 |AFFF |A3F|=E2!fermata!Ez::c4| -w: que-sto~il vi-so ond' io ri-man-go~uc-ci-so. Deh, -w: ran-do fi-so tut-to re-stai con-qui-so. -[V: 3] (ag/f/e2)|A_ddd|A3B|c2!fermata!cz ::A4| -w: vi - - - so ond' io ti-man-go~uc-ci-so. Deh, -w: fi - - - so tut-to re-stai con-qui-so. -% 10 - 15 -[V: 1] f_dec |B2c2|zAGF |\ -w: dim-me-lo ben mi-o, che que-sto\ -=EFG2 |1F2z2:|2F8|] % more notes -w: sol de-si-o_. % more lyrics -[V: 2] ABGA |G2AA|GF=EF |(GF3/2=E//D//E)|1F2z2:|2F8|] -w: dim-me-lo ben mi-o, che que-sto sol de-si - - - - o_. -[V: 3] _dBc>d|e2AF|=EFc_d|c4 |1F2z2:|2F8|] +%abc-2.1 +H:This file contains some example English tunes +% note that the comments (like this one) are to highlight usages +% and would not normally be included in such detail +O:England % the origin of all tunes is England + +X:1 % tune no 1 +T:Dusty Miller, The % title +T:Binny's Jig % an alternative title +C:Trad. % traditional +R:DH % double hornpipe +M:3/4 % meter +K:G % key +B>cd BAG|FA Ac BA|B>cd BAG|DG GB AG:| +Bdd gfg|aA Ac BA|Bdd gfa|gG GB AG:| +BG G/2G/2G BG|FA Ac BA|BG G/2G/2G BG|DG GB AG:| +W:Hey, the dusty miller, and his dusty coat; +W:He will win a shilling, or he spend a groat. +W:Dusty was the coat, dusty was the colour; +W:Dusty was the kiss, that I got frae the miller. + +X:2 +T:Old Sir Simon the King +C:Trad. +S:Offord MSS % from Offord manuscript +N:see also Playford % reference note +M:9/8 +R:SJ % slip jig +N:originally in C % transcription note +K:G +D|GFG GAG G2D|GFG GAG F2D|EFE EFE EFG|A2G F2E D2:| +D|GAG GAB d2D|GAG GAB c2D|[1 EFE EFE EFG|[A2G] F2E D2:|\ % no line-break in score +M:12/8 % change of meter +[2 E2E EFE E2E EFG|\ % no line-break in score +M:9/8 % change of meter +A2G F2E D2|] + +X:3 +T:William and Nancy +T:New Mown Hay +T:Legacy, The +C:Trad. +O:England; Gloucs; Bledington % place of origin +B:Sussex Tune Book % can be found in these books +B:Mally's Cotswold Morris vol.1 2 +D:Morris On % can be heard on this record +P:(AB)2(AC)2A % play the parts in this order +M:6/8 +K:G +[P:A] D|"G"G2G GBd|"C"e2e "G"dBG|"D7"A2d "G"BAG|"C"E2"D7"F "G"G2:| +[P:B] d|"G"e2d B2d|"C"gfe "G"d2d| "G"e2d B2d|"C"gfe "D7"d2c| + "G"B2B Bcd|"C"e2e "G"dBG|"D7"A2d "G"BAG|"C"E2"D7"F "G"G2:| +% changes of meter, using inline fields +[T:Slows][M:4/4][L:1/4][P:C]"G"d2|"C"e2 "G"d2|B2 d2|"Em"gf "A7"e2|"D7"d2 "G"d2|\ + "C"e2 "G"d2|[M:3/8][L:1/8] "G"B2 d |[M:6/8] "C"gfe "D7"d2c| + "G"B2B Bcd|"C"e2e "G"dBG|"D7"A2d "G"BAG|"C"E2"D7"F "G"G2:| + +X:4 +T:South Downs Jig +R:jig +S:Robert Harbron +M:6/8 +L:1/8 +K:G +|: d | dcA G3 | EFG AFE | DEF GAB | cde d2d | +dcA G3 | EFG AFE | DEF GAB | cAF G2 :| +B | Bcd e2c | d2B c2A | Bcd e2c | [M:9/8]d2B c2B A3 | +[M:6/8]DGF E3 | cBA FED | DEF GAB |1 cAF G2 :|2 cAF G3 |] + +X:5 +T:Atholl Brose +% in this example, which reproduces Highland Bagpipe gracing, +% the large number of grace notes mean that it is more convenient to be specific about +% score line-breaks (using the $ symbol), rather than using code line breaks to indicate them +I:linebreak $ +K:D +{gcd}c<{e}A {gAGAG}A2 {gef}e>A {gAGAG}Ad| +{gcd}c<{e}A {gAGAG}A>e {ag}a>f {gef}e>d| +{gcd}c<{e}A {gAGAG}A2 {gef}e>A {gAGAG}Ad| +{g}c/d/e {g}G>{d}B {gf}gG {dc}d>B:|$ +{g}ce {ag}a>e {gf}g>e| +{g}ce {ag}a2 {GdG}a>d| +{g}ce {ag}a>e {gf}g>f| +{gef}e>d {gf}g>d {gBd}B<{e}G {dc}d>B| +{g}ce {ag}a>e {gf}g>e| +{g}ce {ag}a2 {GdG}ad| +{g}c<{GdG}e {gf}ga {f}g>e {g}f>d| +{g}e/f/g {Gdc}d>c {gBd}B<{e}G {dc}d2|] + +X:6 +T:Untitled Reel +C:Trad. +K:D +eg|a2ab ageg|agbg agef|g2g2 fgag|f2d2 d2:|\ +ed|cecA B2ed|cAcA E2ed|cecA B2ed|c2A2 A2:| +K:G +AB|cdec BcdB|ABAF GFE2|cdec BcdB|c2A2 A2:| + +X:7 +T:Kitchen Girl +C:Trad. +K:D +[c4a4] [B4g4]|efed c2cd|e2f2 gaba|g2e2 e2fg| +a4 g4|efed cdef|g2d2 efed|c2A2 A4:| +K:G +ABcA BAGB|ABAG EDEG|A2AB c2d2|e3f edcB|ABcA BAGB| +ABAG EGAB|cBAc BAG2|A4 A4:| + +%abc-2.1 +%%pagewidth 21cm +%%pageheight 29.7cm +%%topspace 0.5cm +%%topmargin 1cm +%%botmargin 0cm +%%leftmargin 1cm +%%rightmargin 1cm +%%titlespace 0cm +%%titlefont Times-Bold 32 +%%subtitlefont Times-Bold 24 +%%composerfont Times 16 +%%vocalfont Times-Roman 14 +%%staffsep 60pt +%%sysstaffsep 20pt +%%musicspace 1cm +%%vocalspace 5pt +%%measurenb 0 +%%barsperstaff 5 +%%scale 0.7 +X: 1 +T: Canzonetta a tre voci +C: Claudio Monteverdi (1567-1643) +M: C +L: 1/4 +Q: "Andante mosso" 1/4 = 110 +%%score [1 2 3] +V: 1 clef=treble name="Soprano"sname="A" +V: 2 clef=treble name="Alto" sname="T" +V: 3 clef=bass middle=d name="Tenor" sname="B" +%%MIDI program 1 75 % recorder +%%MIDI program 2 75 +%%MIDI program 3 75 +K: Eb +% 1 - 4 +[V: 1] |:z4 |z4 |f2ec |_ddcc | +w: Son que-sti~i cre-spi cri-ni~e +w: Que-sti son gli~oc-chi che mi- +[V: 2] |:c2BG|AAGc|(F/G/A/B/)c=A|B2AA | +w: Son que-sti~i cre-spi cri-ni~e que - - - - sto~il vi-so e +w: Que-sti son~gli oc-chi che mi-ran - - - - do fi-so mi- +[V: 3] |:z4 |f2ec|_ddcf |(B/c/_d/e/)ff| +w: Son que-sti~i cre-spi cri-ni~e que - - - - sto~il +w: Que-sti son~gli oc-chi che mi-ran - - - - do +% 5 - 9 +[V: 1] cAB2 |cAAA |c3B|G2!fermata!Gz ::e4| +w: que-sto~il vi-so ond' io ri-man-go~uc-ci-so. Deh, +w: ran-do fi-so, tut-to re-stai con-qui-so. +[V: 2] AAG2 |AFFF |A3F|=E2!fermata!Ez::c4| +w: que-sto~il vi-so ond' io ri-man-go~uc-ci-so. Deh, +w: ran-do fi-so tut-to re-stai con-qui-so. +[V: 3] (ag/f/e2)|A_ddd|A3B|c2!fermata!cz ::A4| +w: vi - - - so ond' io ti-man-go~uc-ci-so. Deh, +w: fi - - - so tut-to re-stai con-qui-so. +% 10 - 15 +[V: 1] f_dec |B2c2|zAGF |\ +w: dim-me-lo ben mi-o, che que-sto\ +=EFG2 |1F2z2:|2F8|] % more notes +w: sol de-si-o_. % more lyrics +[V: 2] ABGA |G2AA|GF=EF |(GF3/2=E//D//E)|1F2z2:|2F8|] +w: dim-me-lo ben mi-o, che que-sto sol de-si - - - - o_. +[V: 3] _dBc>d|e2AF|=EFc_d|c4 |1F2z2:|2F8|] w: dim-me-lo ben mi-o, che que-sto sol de-si-o_. \ No newline at end of file diff --git a/demo/kitchen-sink/docs/diff.diff b/demo/kitchen-sink/docs/diff.diff index 16c898900db..d469437ced6 100644 --- a/demo/kitchen-sink/docs/diff.diff +++ b/demo/kitchen-sink/docs/diff.diff @@ -1,69 +1,69 @@ -diff --git a/lib/ace/edit_session.js b/lib/ace/edit_session.js -index 23fc3fc..ed3b273 100644 ---- a/lib/ace/edit_session.js -+++ b/lib/ace/edit_session.js -@@ -51,6 +51,7 @@ var TextMode = require("./mode/text").Mode; - var Range = require("./range").Range; - var Document = require("./document").Document; - var BackgroundTokenizer = require("./background_tokenizer").BackgroundTokenizer; -+var SearchHighlight = require("./search_highlight").SearchHighlight; - - /** - * class EditSession -@@ -307,6 +308,13 @@ var EditSession = function(text, mode) { - return token; - }; - -+ this.highlight = function(re) { -+ if (!this.$searchHighlight) { -+ var highlight = new SearchHighlight(null, "ace_selected-word", "text"); -+ this.$searchHighlight = this.addDynamicMarker(highlight); -+ } -+ this.$searchHighlight.setRegexp(re); -+ } - /** - * EditSession.setUndoManager(undoManager) - * - undoManager (UndoManager): The new undo manager -@@ -556,7 +564,8 @@ var EditSession = function(text, mode) { - type : type || "line", - renderer: typeof type == "function" ? type : null, - clazz : clazz, -- inFront: !!inFront -+ inFront: !!inFront, -+ id: id - } - - if (inFront) { -diff --git a/lib/ace/editor.js b/lib/ace/editor.js -index 834e603..b27ec73 100644 ---- a/lib/ace/editor.js -+++ b/lib/ace/editor.js -@@ -494,7 +494,7 @@ var Editor = function(renderer, session) { - * Emitted when a selection has changed. - **/ - this.onSelectionChange = function(e) { -- var session = this.getSession(); -+ var session = this.session; - - if (session.$selectionMarker) { - session.removeMarker(session.$selectionMarker); -@@ -509,12 +509,40 @@ var Editor = function(renderer, session) { - this.$updateHighlightActiveLine(); - } - -- var self = this; -- if (this.$highlightSelectedWord && !this.$wordHighlightTimer) -- this.$wordHighlightTimer = setTimeout(function() { -- self.session.$mode.highlightSelection(self); -- self.$wordHighlightTimer = null; -- }, 30, this); -+ var re = this.$highlightSelectedWord && this.$getSelectionHighLightRegexp() - }; -diff --git a/lib/ace/search_highlight.js b/lib/ace/search_highlight.js -new file mode 100644 -index 0000000..b2df779 ---- /dev/null -+++ b/lib/ace/search_highlight.js -@@ -0,0 +1,3 @@ -+new +diff --git a/lib/ace/edit_session.js b/lib/ace/edit_session.js +index 23fc3fc..ed3b273 100644 +--- a/lib/ace/edit_session.js ++++ b/lib/ace/edit_session.js +@@ -51,6 +51,7 @@ var TextMode = require("./mode/text").Mode; + var Range = require("./range").Range; + var Document = require("./document").Document; + var BackgroundTokenizer = require("./background_tokenizer").BackgroundTokenizer; ++var SearchHighlight = require("./search_highlight").SearchHighlight; + + /** + * class EditSession +@@ -307,6 +308,13 @@ var EditSession = function(text, mode) { + return token; + }; + ++ this.highlight = function(re) { ++ if (!this.$searchHighlight) { ++ var highlight = new SearchHighlight(null, "ace_selected-word", "text"); ++ this.$searchHighlight = this.addDynamicMarker(highlight); ++ } ++ this.$searchHighlight.setRegexp(re); ++ } + /** + * EditSession.setUndoManager(undoManager) + * - undoManager (UndoManager): The new undo manager +@@ -556,7 +564,8 @@ var EditSession = function(text, mode) { + type : type || "line", + renderer: typeof type == "function" ? type : null, + clazz : clazz, +- inFront: !!inFront ++ inFront: !!inFront, ++ id: id + } + + if (inFront) { +diff --git a/lib/ace/editor.js b/lib/ace/editor.js +index 834e603..b27ec73 100644 +--- a/lib/ace/editor.js ++++ b/lib/ace/editor.js +@@ -494,7 +494,7 @@ var Editor = function(renderer, session) { + * Emitted when a selection has changed. + **/ + this.onSelectionChange = function(e) { +- var session = this.getSession(); ++ var session = this.session; + + if (session.$selectionMarker) { + session.removeMarker(session.$selectionMarker); +@@ -509,12 +509,40 @@ var Editor = function(renderer, session) { + this.$updateHighlightActiveLine(); + } + +- var self = this; +- if (this.$highlightSelectedWord && !this.$wordHighlightTimer) +- this.$wordHighlightTimer = setTimeout(function() { +- self.session.$mode.highlightSelection(self); +- self.$wordHighlightTimer = null; +- }, 30, this); ++ var re = this.$highlightSelectedWord && this.$getSelectionHighLightRegexp() + }; +diff --git a/lib/ace/search_highlight.js b/lib/ace/search_highlight.js +new file mode 100644 +index 0000000..b2df779 +--- /dev/null ++++ b/lib/ace/search_highlight.js +@@ -0,0 +1,3 @@ ++new +empty file \ No newline at end of file diff --git a/demo/kitchen-sink/docs/raku.raku b/demo/kitchen-sink/docs/raku.raku index 19f212da795..b696e8c11e3 100644 --- a/demo/kitchen-sink/docs/raku.raku +++ b/demo/kitchen-sink/docs/raku.raku @@ -1,41 +1,41 @@ -=begin comment -Raku example for ace -=end comment -class Cook is Employee { - has @.utensils is rw; - has @.cookbooks is rw; - - method cook( $food ) { - say "Cooking $food"; - } - - method clean_utensils { - say "Cleaning $_" for @.utensils; - } -} - -class Baker is Cook { - method cook( $confection ) { - say "Baking a tasty $confection"; - } -} - -my $cook = Cook.new( - utensils => , - cookbooks => 'The Joy of Cooking', - salary => 40000); - -$cook.cook( 'pizza' ); # OUTPUT: «Cooking pizza␤» -say $cook.utensils.perl; # OUTPUT: «["spoon", "ladle", "knife", "pan"]␤» -say $cook.cookbooks.perl; # OUTPUT: «["The Joy of Cooking"]␤» -say $cook.salary; # OUTPUT: «40000␤» - -my $baker = Baker.new( - utensils => 'self cleaning oven', - cookbooks => "The Baker's Apprentice", - salary => 50000); - -$baker.cook('brioche'); # OUTPUT: «Baking a tasty brioche␤» -say $baker.utensils.perl; # OUTPUT: «["self cleaning oven"]␤» -say $baker.cookbooks.perl; # OUTPUT: «["The Baker's Apprentice"]␤» -say $baker.salary; # OUTPUT: «50000␤» +=begin comment +Raku example for ace +=end comment +class Cook is Employee { + has @.utensils is rw; + has @.cookbooks is rw; + + method cook( $food ) { + say "Cooking $food"; + } + + method clean_utensils { + say "Cleaning $_" for @.utensils; + } +} + +class Baker is Cook { + method cook( $confection ) { + say "Baking a tasty $confection"; + } +} + +my $cook = Cook.new( + utensils => , + cookbooks => 'The Joy of Cooking', + salary => 40000); + +$cook.cook( 'pizza' ); # OUTPUT: «Cooking pizza␤» +say $cook.utensils.perl; # OUTPUT: «["spoon", "ladle", "knife", "pan"]␤» +say $cook.cookbooks.perl; # OUTPUT: «["The Joy of Cooking"]␤» +say $cook.salary; # OUTPUT: «40000␤» + +my $baker = Baker.new( + utensils => 'self cleaning oven', + cookbooks => "The Baker's Apprentice", + salary => 50000); + +$baker.cook('brioche'); # OUTPUT: «Baking a tasty brioche␤» +say $baker.utensils.perl; # OUTPUT: «["self cleaning oven"]␤» +say $baker.cookbooks.perl; # OUTPUT: «["The Baker's Apprentice"]␤» +say $baker.salary; # OUTPUT: «50000␤» diff --git a/demo/kitchen-sink/docs/red.red b/demo/kitchen-sink/docs/red.red index d4d76d96f8c..b6c9c1d42cf 100644 --- a/demo/kitchen-sink/docs/red.red +++ b/demo/kitchen-sink/docs/red.red @@ -1,62 +1,62 @@ -Red [] -info: func ['fn /name /intro /args /refinements /locals /return /spec - /arg-num /arg-names /arg-types /ref-names /ref-types /ref-num /type - /local intr ars refs locs ret arg ref typ -][ - intr: copy "" ars: make map! copy [] refs: make map! copy [] locs: copy [] ret: copy [] typ: ref-arg: ref-arg-type: none - if lit-word? fn [fn: to-word fn] - unless find [op! native! function! action!] type?/word get fn [ - cause-error 'user 'message ["Only function types accepted!"] - ] - out: make map! copy [] - specs: spec-of get fn - parse specs [ - opt [set intr string!] - any [set arg [word! | lit-word!] opt [set typ block!] opt string! (put ars arg either typ [typ][[any-type!]])] - any [set ref refinement! [ - if (ref <> /local) (put refs to-lit-word ref make map! copy []) - opt string! - any [set ref-arg word! opt [set ref-arg-type block!] - (put refs/(to-word ref) to-lit-word ref-arg either ref-arg-type [ref-arg-type][[any-type!]]) - ] - | any [set loc word! (append locs loc) opt string!] - opt [set-word! set ret block!] - ]] - - ( - out: case [ - name [to-word fn] - intro [intr] - args [ars] - arg-num [length? ars] - arg-names [copy keys-of ars] - arg-types [copy values-of ars] - refinements [refs] - ref-names [copy keys-of refs] - ref-types [copy values-of refs] - ref-num [length? refs] - locals [locs] - return [ret] - spec [specs] - true [ - make object! [ - name: to-word fn - intro: intr - args: ars - refinements: refs - locals: locs - return: ret - spec: specs - type: type? get fn - arg-num: length? args - arg-names: copy keys-of args - arg-types: copy values-of args - ref-names: copy keys-of refinements - ref-types: copy values-of refinements - ref-num: length? refinements - ] - ] - ]) - ] - out -] +Red [] +info: func ['fn /name /intro /args /refinements /locals /return /spec + /arg-num /arg-names /arg-types /ref-names /ref-types /ref-num /type + /local intr ars refs locs ret arg ref typ +][ + intr: copy "" ars: make map! copy [] refs: make map! copy [] locs: copy [] ret: copy [] typ: ref-arg: ref-arg-type: none + if lit-word? fn [fn: to-word fn] + unless find [op! native! function! action!] type?/word get fn [ + cause-error 'user 'message ["Only function types accepted!"] + ] + out: make map! copy [] + specs: spec-of get fn + parse specs [ + opt [set intr string!] + any [set arg [word! | lit-word!] opt [set typ block!] opt string! (put ars arg either typ [typ][[any-type!]])] + any [set ref refinement! [ + if (ref <> /local) (put refs to-lit-word ref make map! copy []) + opt string! + any [set ref-arg word! opt [set ref-arg-type block!] + (put refs/(to-word ref) to-lit-word ref-arg either ref-arg-type [ref-arg-type][[any-type!]]) + ] + | any [set loc word! (append locs loc) opt string!] + opt [set-word! set ret block!] + ]] + + ( + out: case [ + name [to-word fn] + intro [intr] + args [ars] + arg-num [length? ars] + arg-names [copy keys-of ars] + arg-types [copy values-of ars] + refinements [refs] + ref-names [copy keys-of refs] + ref-types [copy values-of refs] + ref-num [length? refs] + locals [locs] + return [ret] + spec [specs] + true [ + make object! [ + name: to-word fn + intro: intr + args: ars + refinements: refs + locals: locs + return: ret + spec: specs + type: type? get fn + arg-num: length? args + arg-names: copy keys-of args + arg-types: copy values-of args + ref-names: copy keys-of refinements + ref-types: copy values-of refinements + ref-num: length? refinements + ] + ] + ]) + ] + out +] diff --git a/demo/kitchen-sink/docs/vbscript.vbs b/demo/kitchen-sink/docs/vbscript.vbs index f2fcd38b18a..76a10570d45 100644 --- a/demo/kitchen-sink/docs/vbscript.vbs +++ b/demo/kitchen-sink/docs/vbscript.vbs @@ -1,23 +1,23 @@ -myfilename = "C:\Wikipedia - VBScript - Example - Hello World.txt" -MakeHelloWorldFile myfilename - -Sub MakeHelloWorldFile (FileName) - 'Create a new file in C: drive or overwrite existing file - Set FSO = CreateObject("Scripting.FileSystemObject") - If FSO.FileExists(FileName) Then - Answer = MsgBox ("File " & FileName & " exists ... OK to overwrite?", vbOKCancel) - 'If button selected is not OK, then quit now - 'vbOK is a language constant - If Answer <> vbOK Then Exit Sub - Else - 'Confirm OK to create - Answer = MsgBox ("File " & FileName & " ... OK to create?", vbOKCancel) - If Answer <> vbOK Then Exit Sub - End If - 'Create new file (or replace an existing file) - Set FileObject = FSO.CreateTextFile (FileName) - FileObject.WriteLine "Time ... " & Now() - FileObject.WriteLine "Hello World" - FileObject.Close() - MsgBox "File " & FileName & " ... updated." +myfilename = "C:\Wikipedia - VBScript - Example - Hello World.txt" +MakeHelloWorldFile myfilename + +Sub MakeHelloWorldFile (FileName) + 'Create a new file in C: drive or overwrite existing file + Set FSO = CreateObject("Scripting.FileSystemObject") + If FSO.FileExists(FileName) Then + Answer = MsgBox ("File " & FileName & " exists ... OK to overwrite?", vbOKCancel) + 'If button selected is not OK, then quit now + 'vbOK is a language constant + If Answer <> vbOK Then Exit Sub + Else + 'Confirm OK to create + Answer = MsgBox ("File " & FileName & " ... OK to create?", vbOKCancel) + If Answer <> vbOK Then Exit Sub + End If + 'Create new file (or replace an existing file) + Set FileObject = FSO.CreateTextFile (FileName) + FileObject.WriteLine "Time ... " & Now() + FileObject.WriteLine "Hello World" + FileObject.Close() + MsgBox "File " & FileName & " ... updated." End Sub \ No newline at end of file diff --git a/demo/test_package/index.ts b/demo/test_package/index.ts index 9da639d55cc..05440ce2728 100644 --- a/demo/test_package/index.ts +++ b/demo/test_package/index.ts @@ -138,10 +138,13 @@ editor.session.startOperation(); editor.session.endOperation(); editor.on("paste", (e) => { - var htmlString = e.event?.clipboardData?.getData("text/html") - if (htmlString) { - e.text = htmlString + if (e.event && e.event.clipboardData) { + var htmlString = e.event.clipboardData.getData("text/html") + if (htmlString) { + e.text = htmlString + } } }) -themesByName.textmate?.theme; \ No newline at end of file +if (themesByName.textmate) + console.log(themesByName.textmate.theme); \ No newline at end of file diff --git a/demo/test_package/tsconfig.json b/demo/test_package/tsconfig.json index a522a7e7e91..79f64773ac2 100644 --- a/demo/test_package/tsconfig.json +++ b/demo/test_package/tsconfig.json @@ -12,8 +12,8 @@ "noUnusedParameters": true, "noImplicitReturns": true, "noFallthroughCasesInSwitch": true, - "noUncheckedIndexedAccess": true, - "noImplicitOverride": true, + // "noUncheckedIndexedAccess": true, + // "noImplicitOverride": true, "esModuleInterop": true, "forceConsistentCasingInFileNames": true, "module": "commonjs", diff --git a/src/ext/simple_tokenizer.js b/src/ext/simple_tokenizer.js index c5e88f64e6b..51d42701fa0 100644 --- a/src/ext/simple_tokenizer.js +++ b/src/ext/simple_tokenizer.js @@ -57,6 +57,4 @@ function tokenize(content, highlightRules) { return result; } -module.exports = { - tokenize -}; +exports.tokenize = tokenize; \ No newline at end of file diff --git a/src/lib/event.js b/src/lib/event.js index f0c4e6f9bc1..0dc91da6654 100644 --- a/src/lib/event.js +++ b/src/lib/event.js @@ -338,7 +338,9 @@ exports.onIdle = function(cb, timeout) { }, timeout); }; +/**@type {null | ReturnType}*/ exports.$idleBlockId = null; +/** @arg [delay] {null | number} */ exports.blockIdle = function(delay) { if (exports.$idleBlockId) clearTimeout(exports.$idleBlockId); diff --git a/tool/ace_declaration_generator.js b/tool/ace_declaration_generator.js index abf37023292..72c05847654 100644 --- a/tool/ace_declaration_generator.js +++ b/tool/ace_declaration_generator.js @@ -344,8 +344,8 @@ function fixDeclaration(content, aceNamespacePath) { modules.forEach(key => { const newSourceFile = context.factory.updateSourceFile(sourceFile, moduleOutputs[key]); const dirPath = path.dirname(aceNamespacePath.replace("ace-internal", "ace")); - if (!fs.existsSync(dirPath)) { - fs.mkdirSync(dirPath); + if (!fs.existsSync(dirPath + "/types")) { + fs.mkdirSync(dirPath + "/types"); } const outputName = key === "ace" ? `${dirPath}/ace.d.ts` : `${dirPath}/types/ace-${key}.d.ts`; finalDeclarations.push(outputName); diff --git a/tool/test-npm-package.sh b/tool/test-npm-package.sh index abbe623b48e..741e609856e 100755 --- a/tool/test-npm-package.sh +++ b/tool/test-npm-package.sh @@ -15,19 +15,25 @@ PACKAGE_FILE=$(ls ace-*.tgz | sort -V | tail -n 1) mv "$PACKAGE_FILE" ace-code-latest.tgz -# Install the ace package from the npm pack result -# npm install "../../$PACKAGE_FILE" - cd demo/test_package # Clean up previous installation -rm -rf node_modules/ace-code +rm -rf node_modules rm -f package-lock.json + +# Install the ace package from the npm pack result +npm i ../../ace-code-latest.tgz + # Install TypeScript -npm install +npm i typescript@latest +rm -f index.js +npm run build +npm run test -# Run TypeScript type checking +# Install old version of TypeScript +npm i typescript@3.7 +rm -f index.js npm run build npm run test diff --git a/types/ace-lib.d.ts b/types/ace-lib.d.ts index b382737010f..038a675dc06 100644 --- a/types/ace-lib.d.ts +++ b/types/ace-lib.d.ts @@ -107,8 +107,8 @@ declare module "ace-code/src/lib/event" { export function nextTick(callback: any, win: any): void; export const $idleBlocked: boolean; export function onIdle(cb: CallableFunction, timeout: number): ReturnType; - export const $idleBlockId: number; - export function blockIdle(delay: any): void; + export const $idleBlockId: null | ReturnType; + export function blockIdle(delay?: null | number): void; export const nextFrame: any; } declare module "ace-code/src/lib/event_emitter" {