Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

no syntax highlighting #1933

Closed
gour opened this issue Jun 13, 2020 · 8 comments
Closed

no syntax highlighting #1933

gour opened this issue Jun 13, 2020 · 8 comments
Labels
A-syntax-highlighting Area: Syntax Highlighting bug Something isn't working I-daily-editor-blocker An issue blocking use of the editor as a day-to-day editor

Comments

@gour
Copy link

gour commented Jun 13, 2020

Hello,

today, after installing #5d000137 AppImage I noticed that Oni2 does nor do syntax highlighting for any filetype I tried. THought it's maybe problem with some extensions, but even after rm-ing all installed extension and opening simple *.html file, still it does not work.

Here is is the debug log file:
oni2.log

and here is is output of --checkhealth as suggested by Ryan:

oni3.log

I'm on Fedora fc32 Linux.

Sincerely,
Gour

@CrossR CrossR added A-syntax-highlighting Area: Syntax Highlighting bug Something isn't working I-daily-editor-blocker An issue blocking use of the editor as a day-to-day editor labels Jun 13, 2020
@bryphe
Copy link
Member

bryphe commented Jun 13, 2020

Thanks for logging the issue and for the logs, @gour ! The health-check looks good (

Do you happen to have any custom configuration, or are using a custom theme or font? The configuration file would be at ~/.config/oni2/configuration.json.

Possibly related:

@gour
Copy link
Author

gour commented Jun 14, 2020

Do you happen to have any custom configuration, or are using a custom theme or font?

Nope, just a pristine install...

Also, strange thing is that Explore/Sidebar are not visible:

oni2

@CrossR
Copy link
Member

CrossR commented Jun 14, 2020

The sidebar/explorer not being shown is part of Zen mode (You can toggle it off in the Ctrl-Shift-P menu).

What file types are you missing syntax highlights in? The original post says none, but the screenshot has it for JSON files at least.

@gour
Copy link
Author

gour commented Jun 14, 2020

The sidebar/explorer not being shown is part of Zen mode (You can toggle it off in the Ctrl-Shift-P menu).

Ahh, OK. I wondered why it was disabled by default..

What file types are you missing syntax highlights in?

E.g. HTML.

Edit: Yesterday it seemed as nothing was working, while today, after re-installing all the extensions, most of the things are working, except HTML.

bryphe added a commit that referenced this issue Jun 15, 2020
Investigating #1933 - we weren't actually logging out the theme name / file being loaded (which would've been useful information to diagnose the bug). This does not address the root cause of #1933, but means it'll be easier to investigate from the log in the future.
@bryphe
Copy link
Member

bryphe commented Jun 16, 2020

Thanks for the update, @gour !

The HTML issue may be related to #1879 (a bug with our default theme, OneDark Pro... interestingly, other themes seem to work...)

@gour
Copy link
Author

gour commented Jun 16, 2020

The HTML issue may be related to #1879 (a bug with our default theme, OneDark Pro... interestingly, other themes seem to work...)

Yes, I can confirm that with few other themes I've tried, everything is fine. 😄

@thismat
Copy link

thismat commented Aug 6, 2020

The official Dracula theme is also having this issue. I'm adding what I've pin-pointed in the theme here for reference, maybe it will help in pin-pointing what's going on with theme compatibility.

  • Javascript and Typescript were the primary issue, seems to vary based on theme.
  • Markdown works fine
  • HTML works fine

I didn't test more than those languages.

Pin-Pointed Theme Setting

Dracula Theme yaml: https://github.com/dracula/visual-studio-code/blob/master/src/dracula.yml
Line: 410-411

The yaml compiles into this:

// Line 280-287 dracula.json
{
  "scope": [
    "source"
  ],
  "settings": {
    "foreground": "#F8F8F2"
  }
}

Example of what is happening:

image

With block 280-287 removed:

image

Additional Notes

I thought maybe it was an order of how it applies the theme styles that could possibly be causing an issue, maybe layering that source on top of other rules. I moved the source scoped block to the bottom of the theme and tried again, it did not work.

Initially I saw keywords "let this const var" etc, failing. There is an edge case in the theme at lines 1112-1120 (dracula.json):

{
    "name": "Shell variables prefixed with \"$\" (edge case)",
    "scope": [
        "source.shell variable.other"
    ],
    "settings": {
        "foreground": "#BD93F9"
    }
},

Removing this solved that issue initially, but after I reverted the theme completely to a fresh install and just removed the "source" block, it didn't require I remove this one again. Just thought it was worth mentioning that behavior.

I hope this helps in narrowing down the issue.

bryphe added a commit that referenced this issue Aug 17, 2020
__Issue:__ Our scope-selection strategy was not correct in some cases - particularly, the precedence in which we would apply the scopes.

For example, in #1933 - with the dracula theme - there'd be a case where a token would have the following textmate scopes:
- `support.function.console.js`
- `meta.function-call.js`
- `source.js`

For the dracula theme, there is a `source` selector that is intended to be a fallback - however, it was taking precedence over some of the other theme selectors that should've been applied, like `meta.function-call`.

This would cause the entire source file to be highlighted with the `source` scope selector, instead of the more specific ones.

__Defect:__ We apply selectors in reverse order (first, we apply any selectors matching `source.js`, and then `meta.function-call.js source.js`, etc...) - this gives us right precedence. However, if we had a match, we were failing to 'fall-back' to a more specific selector.

__Fix:__ Add a test case to reproduce, and fall back to override with more specific scopes.

This looks to fix a couple of related issues:
- #1933 - no syntax highlighting with OneDark / Dracula for some files
- #2006  - incorrect syntax highlighting for tsx files
- #1879  - html syntax highlighting not displayed
- #1878 - nested syntax highlights not shown

Thanks @CrossR for the helpful tool improvements in #2255 and @thismat for the investigation to narrow down the issue in #1933 !

`dracula` theme - __before__:

![image](https://user-images.githubusercontent.com/13532591/90297301-e2a6a000-de42-11ea-9380-178dc6345bf8.png)

`dracula` theme - __after__:

![image](https://user-images.githubusercontent.com/13532591/90297344-feaa4180-de42-11ea-999c-95936b4e3369.png)
@bryphe
Copy link
Member

bryphe commented Aug 18, 2020

This should be fixed now with #2301 👍 LMK if you're still seeing issues with any theme / languages

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-syntax-highlighting Area: Syntax Highlighting bug Something isn't working I-daily-editor-blocker An issue blocking use of the editor as a day-to-day editor
Projects
None yet
Development

No branches or pull requests

4 participants