Skip to content

[CLOSED] Return LESS/SCSS instead of CSS language when in a LESS/SCSS file #6625

@core-ai-bot

Description

@core-ai-bot

Issue by njx
Friday Mar 28, 2014 at 22:00 GMT
Originally opened as adobe/brackets#7346


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


njx included the following code: https://github.com/adobe/brackets/pull/7346/commits

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions