Skip to content
This repository has been archived by the owner on Sep 6, 2021. It is now read-only.

Return LESS/SCSS instead of CSS language when in a LESS/SCSS file #7346

Merged
merged 1 commit into from
Mar 29, 2014

Conversation

njx
Copy link
Contributor

@njx njx commented Mar 28, 2014

For #7268.

The new Editor.getModeForRange() assumes that the modes being returned by TokenUtils.getModeAt() will properly map to the right language in the current document. These modes aren't actually accurate in general when one language uses a mime-type version of a CodeMirror mode that is also used by another language. For example, our CSS language uses the css mode, and our LESS language uses the "text/x-less" configuration of the css mode.

We currently have a hack for dealing with HTML and XML. This PR adds similar hacks for LESS and SCSS. Looking at languages.json, there are a few other cases that might be similar, but in the other cases the commenting syntax is the same, so we wouldn't run into this specific issue. Nevertheless, we should eventually try to make this more accurate by requesting support in CM for accurately looking up the mime-type in use for a given location (filed as #7345).

@peterflynn

@peterflynn
Copy link
Member

LGTM

peterflynn added a commit that referenced this pull request Mar 29, 2014
Return LESS/SCSS language instead of CSS language when in a LESS/SCSS file
@peterflynn peterflynn merged commit 8c6d382 into master Mar 29, 2014
@TomMalbran TomMalbran deleted the nj/issue-7268 branch March 29, 2014 02:16
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants