cart / atom-hidpi

Scales Atom's interface based on the current monitor's resolution
MIT License
16 stars 2 forks source link

Uncaught SyntaxError: Unexpected number #5

Closed fdevillalobos closed 9 years ago

fdevillalobos commented 9 years ago

[Enter steps to reproduce below:]

  1. ...
  2. ...

Atom Version: 1.0.0 System: Ubuntu 14.04.2 Thrown From: hidpi package, v0.6.0

Stack Trace

Uncaught SyntaxError: Unexpected number

At file:///usr/share/atom/resources/app.asar/static/index.html#%7B%22locationsToOpen%22%3A%5B%7B%22pathToOpen%22%3A%22%2Fhome%2Fprenav_4%2Fsbox%2Ffred-msgs%22%7D%5D%2C%22bootstrapScript%22%3A%22%2Fusr%2Fshare%2Fatom%2Fresources%2Fapp.asar%2Fsrc%2Fwindow-bootstrap.js%22%2C%22resourcePath%22%3A%22%2Fusr%2Fshare%2Fatom%2Fresources%2Fapp.asar%22%2C%22devMode%22%3Afalse%2C%22safeMode%22%3Afalse%2C%22appVersion%22%3A%221.0.0%22%2C%22shellLoadTime%22%3A261%2C%22initialPaths%22%3A%5B%22%2Fhome%2Fprenav_4%2Fsbox%2Ffred-msgs%22%5D%7D:1

SyntaxError: Unexpected number
    at Object.parse (native)
    at Hidpi.update (/home/prenav_4/.atom/packages/hidpi/lib/hidpi.coffee:85:32)

Commands

Config

{
  "hidpi": {
    "manualResolutionScaleFactors": "0.8"
  }
}

Installed Packages

# User
hidpi, v0.6.0
pigments, v0.8.0

# Dev
No dev packages
cart commented 9 years ago

I can replicate this bug by setting manualResolutionScaleFactors to "0.8". manualResolutionScaleFactors should have the format: "1920x1080": 1.5, "2880x1800": 2.5 as shown in the README.

I currently use the JSON.parse() to read the list of resolutions. Therefore errors in syntax will result in parse errors like yours. I will just parse the values manually and make syntax errors fail gracefully.

cart commented 9 years ago

Release a4521cf0f44de8684be10103a0acf3a17b09bafe parses manualResolutionScaleFactors with a regex instead of JSON.parse(). That should fix your problem.