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

Quick Edit shows no results if project contains ANY non-UTF8 CSS/LESS/SCSS files #10013

Closed
nrennert opened this issue Nov 25, 2014 · 22 comments
Closed

Comments

@nrennert
Copy link

I'm using Win 7 Home/64bit. I've installed Brackets version 1.0 build 1.0.0-15191 twice; first time with no extensions, the second time it was a fresh install with Extract for Brackets installed. In both installs I tried to use the Ctrl+E, right-click and choose Quick Edit and tried the menu. In neither case did the function work. I did get it to work on a css file when I tried to change a color. In that case I used the Ctrl+E shortcut. I would love to use this feature; any help to figure out why it doesn't work would be great.
I tried using it on a bare bones html file with a very short and simple css file and it still didn't work.

@RaymondLim
Copy link
Contributor

@nrennert Did you use File > Open Folder to open the root folder of your file as the project root? If not, then you won't be able to use Quick Edit by just opening the file.

@nrennert
Copy link
Author

Yes, I opened the whole folder and then opened the file by double clicking on it in the File Tree view. The Live Preview works but not html file. Quick Edit does work in the css file though.

@nrennert nrennert reopened this Nov 25, 2014
@RaymondLim
Copy link
Contributor

@nrennert Can you provide some sample HTML code with steps to reproduce so that we can understand what is not working for you?

@nrennert
Copy link
Author

I tried it on a super simple html page (saved to the same folder) and a super simple css file (saved to css/test.css) without success.
index.html =

<html>
<head>
    <link rel="stylesheet" href="css/test.css" type="text/css" />
</head>
    <body>
    <h1>This is a heading</h1>
    </body>
</html>

css file =

body {
 color: #3966ba;   
}

@RaymondLim
Copy link
Contributor

I corrected your html and css sample code and wrap them with three backticks to show them as code blocks. And I also try it by placing the cursor inside the body tag and Quick Edit is working for me. I see the CSS code show up in inline editor. Are you not seeing the inline editor?

@nrennert
Copy link
Author

no, I've tried it with several different files; several I'm working on and then I also created this very short and simple test file. Nothing has worked.

@nrennert
Copy link
Author

<html>
<head>
        <link rel="stylesheet" href="css/test.css" type="text/css" />
</head>
    <body>
    <h1>This is a heading</h1>
    </body>
</html>

@RaymondLim
Copy link
Contributor

@nrennert Can you take a screenshot that include left sidebar, menu and your cursor position in the html file so that we can see what went wrong with your testing? Below is a sample screenshot showing Quick Edit not working when I invoke it in the body tag of a not-yet-saved new file. Are you getting a message popup as in my screenshot?

quickedit1

@nrennert
Copy link
Author

Here is a screen shot of the simple html file with test.css.
test

@RaymondLim
Copy link
Contributor

@nrennert Can you open Developer Tools (Debug > Show Developer Tools) and look into Console tab? And tell us whether you see any errors or warnings in there.

You mentioned that Ctrl+E is working in CSS file for colors. Can you try one more thing in a CSS file by pressing Ctrl+T? See do you get a list pop up on the top right corner showing all the selectors in your css file?

@nrennert
Copy link
Author

Here is the screen shot of the console.
test

Here is the screen shot after pressing Ctr+t
test2

@nrennert
Copy link
Author

On another file of mine I get a lot more information on the console. This might help.
test3

@peterflynn
Copy link
Member

@nrennert Can you try this?

  1. Debug > Show Developer Tools in the menu
  2. Press Ctrl-O and type "CSSUtils"
  3. Go to line 1404 (search for _findMatchingRulesInCSSFiles and you should be close to it). This line should say oneFileResult.reject(error);. Once you find that line, click on the line number to add a breakpoint on that line.
  4. Back in Brackets, put your cursor on the <h1> tag and press Ctrl-E
  5. At this point Brackets will probably pause (and get covered with a dark gray tint). Go back to developer tools when this happens.
  6. In the console, type error -- what value does it print after you do that? If you can take a screenshot of the "Call Stack" panel in the "Sources" tab, that would be very helpful too. Thanks!

@peterflynn
Copy link
Member

If my read of this is correct, the issue is that CSSUtils._findMatchingRulesInCSSFiles() will fail if any one file is unreadable for some reason. In contrast, FindInFiles silently ignores errors while reading files.

So, we should make Quick Edit similarly robust to file IO errors. Although since we're filtering on file extension in this case, read errors are a little more unexpected (vs. FindInFiles where we could easily encounter binary files with unknown extensions) -- so I think in this case we should log a warning to the console instead of being 100% silent.

@nrennert
Copy link
Author

Here is the screen shot of the call stack. The error is "unsupportedEncoding". Could Brackets have a problem with files that are in utf8? All my files are in utf8, including the css files.
test4

@RaymondLim
Copy link
Contributor

Interesting. Can you share one of the utf-8 css files that is causing this failure?

@nrennert
Copy link
Author

I've just tested the utf8 possibility and it does not make a difference. Even with the html and css file both being in ANSI my version of Brackets still doesn't have the Quick Edit function.

@peterflynn
Copy link
Member

@nrennert UTF-8 is actually the only encoding that Brackets does support. So if you have even a single CSS/SCSS/LESS file that is in some other encoding (including ANSI), then this bug will prevent Quick Edit from working.

@peterflynn peterflynn self-assigned this Dec 1, 2014
peterflynn added a commit that referenced this issue Dec 2, 2014
…project

contians any non-UTF8 CSS/LESS/SCSS files) - Silently ignore files that can't
be read, and continue the search anyway (warning logged to console, but no
user-visible error shown). Similar to what we've always done for Find in Files.

With unit test, and matching test for the pre-existing same behavior in Find
in Files. Also clean up dated use of waitsFor() in the CSSUtils test spec.
@peterflynn
Copy link
Member

Posted a fix for the encoding issue, which is presumably what's going on here (and is definitely a real issue regardless)

busykai added a commit that referenced this issue Dec 3, 2014
Semi-fix bug #10013 (CSS Quick Edit provider does not respond if project contains any non-UTF8 CSS/LESS/SCSS files)
@dangoor
Copy link
Contributor

dangoor commented Dec 9, 2014

@nrennert The fix for this should be in 1.1. Please try that out when 1.1 is released and reopen this issue if you're having the same problem.

@dangoor dangoor closed this as completed Dec 9, 2014
@peterflynn peterflynn changed the title Quick Edit not working (please help) Quick Edit shows no results if project contains ANY non-UTF8 CSS/LESS/SCSS files Dec 17, 2014
@peterflynn
Copy link
Member

Clarifying title

@Ch4kr4k
Copy link

Ch4kr4k commented Apr 1, 2018

Im in linux parrot sec as a root user
Brackets doesnt even launch ,
Tried removing noroot from brackets.profile still not launching
Need help thank you

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants