-
Notifications
You must be signed in to change notification settings - Fork 15
utf-8 strings and unexpected end-of-input #103
Comments
Adding |
Starting atom from terminal also solves the problem. |
This is quite irritating. Anyone know why this has recently broken? |
Hmmm, in v1.2.4 the argument sent to Ruby was changed from @alistairholt what platform are you on? The proper solution is as @zenbro already said: Adding the following at the start of the file: # encoding: utf-8 This tells Ruby the encoding of the file in the proper method, the argument is only meant to be a fallback to try to catch cases where the developer forgot it. |
@Arcanemagus With Ruby 2.0 utf-8 is the default encoding, and that encoding comment is no longer required. FWIW I struck this "bug" today too and came looking for a solution. In my case it's thinking ’ is terminating a single quoted string. |
I'm also seeing this issue. I just quit Atom and restarted from Terminal per @zenbro's recommendation and am not seeing the issue anymore. I'm on MacOS Sierra. |
@timhaines I'm on ruby 2.2.3 and still having this without the encoding-comment. |
/!\ This workaround make linter-ruby to not detect any errors |
@Arcanemagus I'm on macOS Sierra 10.12.3. As @timhaines said, we shouldn't need to add the magic encoding comment as UTF-8 is the default script encoding since Ruby v2.0. My Ruby (ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-darwin16]) man page shows |
I tried @fabien-michel 's workaround and that actually leads to the linter not working anymore: The The only way to get the linter working correctly for me right now is @stevehanson 's solution: Restarting atom from the terminal. |
@wdspkr which platform are you on and which Ruby are you running? |
@wdspkr You are true, I've updated my comment to warn readers |
Can somebody on macOS try the changes from #113? |
@Arcanemagus It does not fix the problem. linter work but unicode chars in string still raise the "unexpected end-of-input" error |
And this is only an issue when Atom is launched from the GUI, correct? It works if launched from a terminal? |
If anyone is willing to help debug this I'm available on Atom's Slack. I have no access to a macOS machine, and it seems that the fix that works for some of you isn't working for others, so it's a rather complex issue with how Ruby works differently between OS versions. |
I've rolled some tests :
|
@fabien-michel That completely removes the ability to lint the current contents of the editor and instead only lints the on-disk status. |
I tried the changes in #113 on MacOS. They do not fix the error. @fabien-michel 's changes on the other hand do the trick. |
@wdspkr Did you disable "Lint on Change" in the Linter settings? This provider is currently marked as supporting linting files as they change. The entire problem here is that when sending the content to #113 is an attempt to work around the mismatching option style, since It's looking like to figure this out I'll need somebody where the changes from #113 aren't working to let me investigate their system to see if we can find something that works for everyone. |
@Arcanemagus TIL! Sweet. Indeed I had "Lint on Change" disabled. const execArgs = [
'-c', // Check syntax only, no execution
'-w', // Turns on warnings
// Set the encoding to UTF-8
'--external-encoding=utf-8',
'--internal-encoding=utf-8',
filePath
];
const execOpts = {
stdin: fileText,
stream: 'stderr',
allowEmptyStderr: true,
}; |
@wdspkr Can you verify that it's actually linting the contents of the editor? I thought that if you provided a file name it ignored anything on And yes, the entire point of switching to |
@Arcanemagus You are right. I'm running out of ideas and guess I will just resort to starting atom from the terminal (which still works). Thanks for your time though. This project really helps my workflow! ❤️ |
I have the same issue and it still solvable only by starting atom from terminal or by adding this string |
This atom/atom#15634 kind of breaks the "start atom from terminal" workaround. 😞 |
…s with utf-8 on macOS
…th utf-8 on macOS
@jarvis6561 no updates yet. |
Hi!
Every method call with utf-8 string as argument ends with following error:
unexpected end-of-input, expecting keyword_end
ruby -wc
returns Syntax OK.Simple code to reproduce this:
Atom version: 1.12.6
linter-ruby version: 1.2.4
System: macOS 10.12.1
Ruby versions: 2.1.10, 2.2.3, 2.3.3
The text was updated successfully, but these errors were encountered: