Comments (44)
@bathos I figured this out. Oddly enough, it appears that ST 3176 may or may not (depending on your OS it seems) load the Ecmascript syntax as the default scope:source.js
, such as when the base HTML syntax embeds javascript. However, if I change our root scope from source.js source.es
to just source.js
, then indeed the Markdown and HTML base syntaxes will start using Ecmascript syntax for embedded js if they weren't already. This inevitably causes the errors @acconrad is reporting here.
I'm going to disable the affected nested syntaxes for now: DOT and HTML. Unfortunately, it seems that we cannot nest any syntax that ultimately embeds or pushes a source:js
to the stack, (e.g., we nest DOT, DOT pushes HTML, HTML pushes JS, stack blows up). Really a poor oversight by the ST3 team if you ask me :/
As a remedy, I'm going to look into generating a compatible HTML, DOT, and Markdown syntax directly from the base syntaxes. That way we can just ship our own "safe" nested syntaxes.
from ecmascript-sublime.
This is most certainly caused by https://github.com/sublimehq/Packages/blob/master/Markdown/Markdown.sublime-syntax#L993 which loads contexts from Ecmascript, which then includes contexts from Markdown, when then loads contexts from Ecmascript, which then includes contexts from Markdown, .... at least, that is my suspicion: sublimehq/sublime_text#2252
I will see if switching to embed
will fix this. Btw, can our releases target specific builds of Sublime?
from ecmascript-sublime.
That example is tags vs branch. I didn’t see any with tags unprefixed + tags prefixed, but I didn’t search for very long so I dunno. (I’m surprised that I couldn’t find any of this documented — I might just be missing it?)
from ecmascript-sublime.
Thanks for going deep on this blake, it’s very appreciated. I haven’t been able to repro either unfortunately.
from ecmascript-sublime.
I'm not getting this on my end. Does this happen no matter the file contents or only when using nested syntaxes (i presume that's why it's complaining about with_prototype
)? If so, could you post a snippet that is causing this? Which version of Sublime?
from ecmascript-sublime.
I‘m getting it in Dev Build 3166. It happens with any file, even completely empty; it seems as if it may occur during a phase prior to the point of application, like it‘s validating/processing/compiling and that pops up.
from ecmascript-sublime.
I don't have a license so I can't access the dev build channel, but this could have to do with the new embed
feature making nesting syntaxes with include/push/set
obsolete. I've definitely encountered this error before during development with this and other syntaxes, but not sure what's causing it now.
I would think that disabling the rule associated with the interpolation match in the syntax_AFTER_OPEN context would prevent ST from thinking there's any recursion, this one:
Ecmascript-Sublime/ecmascript.sublime-syntax
Line 5528 in e203d3a
from ecmascript-sublime.
Same problem here... using latest sublime build..
Tried commenting the line @blake-regalia mentioned, but it dit no fix =(
from ecmascript-sublime.
@rafapaulin Did you only comment out that line or the whole rule? I should have highlighted the range, try commenting out these 5 lines:
Ecmascript-Sublime/ecmascript.sublime-syntax
Lines 5528 to 5532 in e203d3a
from ecmascript-sublime.
I have another hunch. It's possible that the Sublime devs thought of making push/set
native syntax defs automatically use the new embed
feature, which would be problematic for the nested JavaScript rule because it would recursively load the current default JavaScript syntax, which would be our Ecmascript syntax def. This would certainly be a Sublime bug and not a feature. If this is the case and if commenting out these lines solves the issue, it would be a good indication of whats causing it:
Ecmascript-Sublime/ecmascript.sublime-syntax
Lines 5687 to 5698 in e203d3a
from ecmascript-sublime.
@blake-regalia tried to comment out both ranges you suggested, appart from each other and together... still did not fix =(
from ecmascript-sublime.
I may share my sublime license with you if you need
from ecmascript-sublime.
I don’t know much about the new nesting stuff — am I understanding correctly that it is a breaking change in Sublime? Like, is it even possible to have the nested syntaxes working in both current Sublime 3 and the dev build?
from ecmascript-sublime.
@bathos it should not be a breaking change, and could have just been a bug in 3166 -- looking at the current dev build changelogs seems like there were some crash issues w 3166, does this still happen in the most recent build?
from ecmascript-sublime.
3167 and 3168 still exhibit the same behavior (sorry I haven’t been able to experiment with this properly myself yet, just been busy w/ work)
from ecmascript-sublime.
3170 is now stable and released, so I believe this now affects all users, womp. Gonna look into it tonight.
from ecmascript-sublime.
Confirmed that it’s related to nested syntax by fully disabling them — gonna try to re-enable bit-by-bit to see when it freaks out.
from ecmascript-sublime.
...it’s the markdown one :o
from ecmascript-sublime.
I published the easy fix (disabling nested markdown) till we can figure out why this happens. There’s nothing obvious to me; it seems like it’s got to be something unique about the Markdown syntax definition triggering it.
from ecmascript-sublime.
Btw, can our releases target specific builds of Sublime?
I think/thought this is possible, but I’m not sure what the correct way to do it is. The registry repo is Package Control Channel, where you’ll see our entry complete with the typo ES2105
haha:
{
"name": "Ecmascript Syntax",
"details": "https://github.com/bathos/Ecmascript-Sublime",
"labels": [ "Javascript", "ES6", "ES2105" ],
"releases": [
{
"sublime_text": ">=3084",
"tags": true
}
]
},
In the releases array, sublime_text
can associate an entry with a sublime version range. In this case it’s indicating that it should be available only for 3084 (the version that introduced sublime-syntax) and later, and tags: true
means that Package Control should look for semver git tags and treat them as releases.
If you look around at other entries, you’ll see that many specify a branch
instead of tags
. This seems like what we’d be looking for, but there’s a catch:
Please note that branch-based releases have been deprecated and no new packages will be accepted that utilize that feature. Existing packages are encouraged to update to using tags.
So we can’t use the branch
option, which leaves me uncertain what one is supposed to do to have different releases associated with sublime version ranges. I don’t see any mention of this in the Package Control docs so far.
from ecmascript-sublime.
I think I found an example that does it with tags — apparently it can specify a prefix:
{
"name": "ChineseLocalizations",
"previous_names": ["ChineseLocalization"],
"details": "https://github.com/rexdf/ChineseLocalization",
"labels": ["localization", "chinese", "中文", "japanese", "日本語"],
"releases": [
{
"sublime_text": "<3000",
"tags": "st2-"
},
{
"sublime_text": ">=3000",
"tags": "st3-"
}
]
},
Their tags list looks like this.
from ecmascript-sublime.
Interesting, it looks like you can also use "tags": true
for the default/latest build and optionally use a prefix for others, for example:
"releases": [
{
"sublime_text": "<3000",
"branch": "st2"
},
{
"sublime_text": ">=3000",
"tags": true
}
]
Although they are using 'branch' for the alternate instead of tags. The better question is, why doesn't Package Control have this documented somewhere?
from ecmascript-sublime.
Found it:
// If your package is only compatible with specific builds of
// Sublime Text, this will cause the package to be hidden from
// users with incompatible versions.
//
// The "tags" key can be true for all valid semantic version tags, or
// can be a prefix string. Only tags in the form
// {prefix}{semantic_version} will be selected. In the example below,
// the entry with "sublime_text": "<3000" will match tags like:
//
// "st2-1.0.0"
// "st2-1.1.0"
//
// The release with "sublime_text": ">=3000" will match tags like:
//
// "st3-1.0.0"
// "st3-1.1.0"
{
"details": "https://github.com/wbond/sublime_alignment",
"releases": [
{
"sublime_text": "<3000",
"tags": "st2-"
},
{
"sublime_text": ">=3000",
"tags": "st3-"
}
]
},
It's in their example-repository.json.
from ecmascript-sublime.
New changes don't use embed and are backwards-compatible so no need for tags yet.
from ecmascript-sublime.
I’m told this has begun again. My guess is that it was triggered indirectly by changes in one of the delegated syntaxes, though I won’t be able to check which till later :/
from ecmascript-sublime.
Can anyone share a snippet that causes this? Also what version of Sublime? I'm running build 3176 and am not able to get any errors.
from ecmascript-sublime.
I’ll try to get some more info. Two people messaged me directly about it today. My impression was that, as before, no file even needs to be open — it just happens from the extension existing at all.
from ecmascript-sublime.
Hmm... just looked through all the latest base syntax package commits that might affect this and found: CSS, SQL, and ShellScript syntaxes changed in last few weeks, the only suspicious commit being for bash at this line here: sublimehq/Packages@4cfa7b9#diff-fe682d41416db7dad26aa8c60e0dc02eR300 so I cloned it and tested, but no problems. I'll wait for more info.
from ecmascript-sublime.
Hi there! So I was one of those two people to message about this. I have the Ecmascript syntax installed on ST3.1.1 build 3176.
Steps to reproduce:
- Open SublimeText. It will blow up only one
- Open a repo with both
.md
and.js
files where the default syntax for.md
isMarkdown
and the default syntax for.js
isEcmascript
- Open a readme or javascript file
- The following popup is shown:
Another example I caught while opening a JS file:
from ecmascript-sublime.
Thanks @acconrad , can you please confirm which version of the "Ecmascript Syntax" package you have installed? Ctrl+Shift+P > "Package Control: List Packages" > "Ecmascript Syntax".
EDIT: I suspect you have an outdated version since we recently removed nested Markdown support, mainly for this very reason.
from ecmascript-sublime.
Looks like I'm on the same version as you
from ecmascript-sublime.
This is a tricky one -- not sure what's causing it but I went ahead and published a release that might fix it. Please restart Sublime, check that it updates Ecmascript Syntax to v1.6.7 and then see if the problem still exists.
from ecmascript-sublime.
@blake-regalia unfortunately no change, and I verified I now have 1.6.7 :(
from ecmascript-sublime.
Hmm - I'm still unable to reproduce this no matter what I try, but I have some ideas about diagnosis, @acconrad . This should help us narrow it down:
- Remove the Ecmascript Syntax package via Package Control.
- Open the user preferences directory, Sublime Text > Preferences > Browse Packages ... "User". Do you have an "ecmascript.sublime-settings" file here? What about a "Markdown.sublime-settings" or any other relevant files? Please let me know if you do. And if you do, move them away from this directory temporarily.
- Restart Sublime.
- Open a Markdown
.md
file. There should be no errors at this point, if there are -- something else is up. - Copy this code-fenced section into the markdown file:
```js
call();
```
- Put your caret on the
call
text and Ctrl+Shift+P (oops, last time I said this I meant Cmd+Shift+P, this time i really mean Ctrl). Screenshot/copy the scopes that list under the caret and post it here. - With the Markdown file still open, change the syntax association by going View > Syntax > Open all with current extension as ... > Plain Text.
- Install the Ecmascript Syntax via Package Control.
- Open a JavaScript
.js
file. What happens? - If you get to this step and you haven't encountered any errors yet, try changing the Markdown association back by opening an
.md
file and opening all with current extension as Markdown>Markdown.
from ecmascript-sublime.
@blake-regalia It did blow up on Step 4. I followed it to the tee, but I only had a ecmascript.sublime-settings
file in that User/
folder but not a Markdown.sublime-settings
, so what's next?
from ecmascript-sublime.
Interesting... What are the errors you got this time? Could you post a screenshot?
from ecmascript-sublime.
Btw @acconrad for our own sanity, and to get you coding again in the meantime, I created a branch without nested syntax support. Here's how you can install it:
cd ~/Library/Application\ Support/Sublime\ Text\ 3/Packages/User/
git clone -b safe-mode https://github.com/bathos/Ecmascript-Sublime ecmascript
Then, View > Syntax > Open all with current extension as... > User > Ecmascript
from ecmascript-sublime.
@blake-regalia you are awesome, thank you for diving into this!
from ecmascript-sublime.
@bathos I drafted a release for 1.7.0, but want to make sure it doesn't break anything else incidentally. Could you update your local repo and check that everything looks good?
from ecmascript-sublime.
Released 1.7.0
from ecmascript-sublime.
Sorry I missed that last request @blake-regalia ... but wow! This is a crazy impressive update (and everything seems to be fine).
from ecmascript-sublime.
May have spoken too soon. I’ve seen no highlighting issues, but it seems that shortcuts for commenting out lines (both single and multi) have stopped working. If you can confirm (not 100% sure ES Sublime is the cause yet) I’ll open a new issue.
from ecmascript-sublime.
Hmm I can't seem to reproduce this yet. I just noticed some old scopes on a few .tmPreferences files and patched them real quick, see if that did anything?
from ecmascript-sublime.
This was fixed by the new release! Thanks again. 🙇
from ecmascript-sublime.
Related Issues (20)
- a way of setting the default syntax for a template tag HOT 2
- Add support for graphql nested syntax HOT 5
- Comma background in destructuring assignments HOT 5
- Error loading colour scheme Packages/Ecmascript Syntax/excelsior.tmTheme HOT 4
- Update repository description HOT 3
- Add support for pug nested syntax HOT 5
- Build process does not work on Windows HOT 1
- Pipeline operator
- styled jsx has no css autocomplete and emmet does not work HOT 5
- Use a package setting to override the block comment directive syntax HOT 6
- Add support for interpolated attribute values in HTML / HTML-like template tags without quotation marks HOT 7
- AE identifiers prefixed with reserved words followed by `$`
- Digits after binary/octal HOT 4
- Async iterable inline literal object
- Associating Ecmascript with source.js ? HOT 4
- Update README ? HOT 1
- Symbols are not indexed in embedded syntax HOT 1
- Add DOM support for built-in color schemes HOT 5
- Turn off Safe Mode/Prefer Ecmascript standard mode. HOT 2
- LSP integration HOT 4
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 ecmascript-sublime.