Skip to content
This repository was archived by the owner on Dec 15, 2022. It is now read-only.

JavaScript is broken #183

Closed
ghost opened this issue Aug 1, 2015 · 8 comments
Closed

JavaScript is broken #183

ghost opened this issue Aug 1, 2015 · 8 comments
Assignees
Labels

Comments

@ghost
Copy link

ghost commented Aug 1, 2015

Hi. JavaScript the syntax highlighting is broken and this is affecting me in both Atom and GitHub code viewer. Please see the attached images.

untitled 2
untitled

github-linguist/linguist#2530

@ghost
Copy link
Author

ghost commented Aug 1, 2015

linguist/issues/2530

@winstliu
Copy link
Contributor

winstliu commented Aug 1, 2015

Looks like another case where strings aren't given enough priority.

@winstliu winstliu added the bug label Aug 1, 2015
@ghost
Copy link
Author

ghost commented Aug 1, 2015

Fortunately, const now works properly when using the destructuring syntax. This was failing a few weeks ago, but I was too lazy to report it.

const { a, b } = f()

Having said this, const is still broken in the following case:

export function* find (path, hook = _ => _) {
  const root = join(process.cwd(), path)
  return hook((yield fs.stat(path))
    .isDirectory() ? yield resolve(root) : root)
  function* resolve (root) {
    for (const file of function* () {
      for (const ext of Object.keys(jsVariants))
        for (const name of ["Flyfile", "flyfile"])
          yield join(root, `${name}${ext}`)
    }()) try { if (yield fs.stat(file)) return file } catch (_) {}
    throw { code: "ENOENT" }
  }
}

@winstliu
Copy link
Contributor

winstliu commented Aug 1, 2015

Yeah, that's been fixed - Linguist just needs to update to a commit that has it.

@winstliu winstliu self-assigned this Aug 1, 2015
@winstliu
Copy link
Contributor

winstliu commented Aug 1, 2015

Interestingly, putting the bracket on a newline breaks highlighting in a different way...

@ghost
Copy link
Author

ghost commented Aug 1, 2015

😭

@ghost
Copy link
Author

ghost commented Aug 1, 2015

Another one that has been broken for a while (at least in Atom), which I also forgot to report is when using default parameters:

export function filter (pkg, load, blacklist = [], bind = "babel/register") {

@winstliu
Copy link
Contributor

winstliu commented Aug 1, 2015

Yeah, I'm looking at the function-params regex, and it's pretty basic.

winstliu added a commit that referenced this issue Aug 1, 2015
In addition, add a constructor regex
-Fixes #183
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

1 participant