SublimeText/AFileIcon

EditorConfig file does not show correct syntax highlighting

mrmeszaros opened this issue · 4 comments

After installing this package the .editorconfig file does not show a proper syntax highlighting.

Expected Behavior

Using custom file icons should not affect the syntax highlighting.

Current Behavior

Although the correct syntax is selected - the .editorconfig file has no syntax highlighting.

Steps to Reproduce (for bugs)

  1. Install the A File Icon (this) package

  2. Install the EditorConfig package

  3. Create an .editorconfig file - for example:

    root = true
    
    [*]
    indent_style = tab
    # indent_size = 
    end_of_line = lf
    charset = utf-8
    trim_trailing_whitespace = true
    insert_final_newline = true
  4. Set syntax to EditorConfig (although it should be that by default)

Context

Currenty I have to chose between the nice icons and proper syntax highlighting for the .editorconfig file.

Your Environment

The Package Settings → A File Icon → Environment command does not exist anymore.

Here is the console output with "dev_mode": true:

startup, version: 4143 osx arm64 channel: stable
executable: /Applications/Sublime Text.app/Contents/MacOS/sublime_text
application: /Applications/Sublime Text.app
working dir: /
packages path: /Users/myself/Library/Application Support/Sublime Text/Packages
state path: /Users/myself/Library/Application Support/Sublime Text/Local
zip path: /Applications/Sublime Text.app/Contents/MacOS/Packages
zip path: /Users/myself/Library/Application Support/Sublime Text/Installed Packages
ignored_packages: ["Vintage"]
pre session restore time: 0.433433
OpenGL Context Information:
  GL API Version: 4.1 Metal - 83.1
  GLSL Version: 4.10
  Vendor: Apple
  Renderer: Apple M1 Pro
first paint time: 0.521806
startup time: 0.579086
git: using configuration from system git install
git: tracking working dir /Users/myself/dev/my-local-config
environment variables loaded using: /bin/zsh -l
reloading python 3.3 plugin 0_package_control_loader.00-package_control
reloading plugin Default.arithmetic
reloading plugin Default.auto_indent_tag
reloading python 3.3 plugin 0_package_control_loader.50-pyyaml
reloading plugin Default.block
reloading python 3.3 plugin EditorConfig.EditorConfig
reloading plugin Default.colors
reloading plugin Default.comment
reloading plugin Default.convert_color_scheme
reloading plugin Default.convert_syntax
reloading plugin Default.copy_path
reloading plugin Default.echo
reloading plugin Default.exec
reloading python 3.3 plugin fish.do_fish_indent
reloading python 3.3 plugin fish.highlighter_base
reloading plugin Default.fold
reloading plugin Default.font
reloading plugin Default.goto_line
reloading python 3.3 plugin fish.highlighter_compat
reloading plugin Default.history_list
reloading plugin Default.html_print
reloading plugin Default.indentation
reloading plugin Default.install_package_control
reloading plugin Default.keymap
reloading plugin Default.kill_ring
reloading plugin Default.mark
reloading plugin Default.new_templates
reloading plugin Default.open_context_url
reloading plugin Default.open_in_browser
reloading plugin Default.pane
reloading plugin Default.paragraph
reloading plugin Default.paste_from_history
reloading plugin Default.profile
reloading plugin Default.quick_panel
reloading plugin Default.rename
reloading plugin Default.run_syntax_tests
reloading plugin Default.save_on_focus_lost
reloading plugin Default.scroll
reloading plugin Default.set_unsaved_view_name
reloading plugin Default.settings
reloading plugin Default.show_scope_name
reloading plugin Default.side_bar
reloading plugin Default.sort
reloading plugin Default.switch_file
reloading plugin Default.symbol
reloading plugin Default.transform
reloading plugin Default.transpose
reloading plugin Default.ui
reloading plugin CSS.css_completions
reloading plugin Diff.diff
reloading plugin HTML.encode_html_entities
reloading plugin HTML.html_completions
reloading plugin ShellScript.ShellScript
reloading plugin A File Icon.plugin
reloading plugin GitSavvy.__init__
reloading plugin GitSavvy.git_savvy
reloading python 3.3 plugin fish.highlighter_path
reloading python 3.3 plugin Package Control.1_reloader
reloading python 3.3 plugin Package Control.2_bootstrap
reloading python 3.3 plugin Package Control.Package Control
reloading python 3.3 plugin ProjectManager.json_file
reloading python 3.3 plugin ProjectManager.project_manager
reloading python 3.3 plugin SideBarEnhancements.SideBar
reloading python 3.3 plugin SideBarEnhancements.SideBarAPI
reloading python 3.3 plugin SideBarEnhancements.SideBarDefaultDisable
reloading python 3.3 plugin Theme - Monokai Pro.Monokai Pro
plugins loaded
A File Icon: Initializing settings
A File Icon: Initializing icons
         >>> All the necessary icons are provided
A File Icon: Getting installed themes
         >>> {'Theme - Default': ['Adaptive.sublime-theme', 'Default Dark.sublime-theme', 'Default.sublime-theme'], 'User': ['Monokai Pro (Filter Machine).sublime-theme', 'Monokai Pro.sublime-theme']}
A File Icon: Getting the list of theme packages with customization support
         >>> set()
A File Icon: Preparing general patch
         >>> [{'class': 'icon_file_type', 'layer0.tint': None, 'layer0.opacity': 0.9, 'content_margin': [8, 8]}, {'class': 'icon_file_type', 'layer0.tint': None, 'parents': [{'class': 'tree_row', 'attributes': ['hover']}], 'layer0.opacity': 0.7}, {'class': 'icon_file_type', 'layer0.tint': None, 'parents': [{'class': 'tree_row', 'attributes': ['selected']}], 'layer0.opacity': 1.0}]
A File Icon: Preparing specific patch
         >>> [{'class': 'icon_file_type', 'layer0.tint': None, 'content_margin': [8, 8]}]
A File Icon: Patching themes
A File Icon: Ignored `Adaptive.sublime-theme`
A File Icon: Ignored `Default Dark.sublime-theme`
A File Icon: Ignored `Default.sublime-theme`
A File Icon: Ignored `Monokai Pro (Filter Machine).sublime-theme`
A File Icon: Ignored `Monokai Pro.sublime-theme`
A File Icon: Removing obsolete theme patches
A File Icon: Updating aliases
Package Control: Skipping automatic upgrade, last run at 2023-06-23 16:03:59, next run at 2023-06-23 17:03:59 or after

This conflict is caused by the design of EditorConfig's syntax.

EditorConfig.sublime-syntax includes scope:source.ini and provides a hidden simplistic INI.sublime-syntax for that scope.

A File Icon doesn't (can't) accept hidden syntaxes as replacement for its dummy syntaxes.

Thus it can't be fixed by A File Icon without causing other issues.

Easiest solution would be to also install the "INI" package, which also provides more sophisticated highlighting for ini files.

Otherwise changes to EditorConfig package would be required, but I wouldn't be surprised its current design to be meant for making use of INI package, optionally.

@deathaxe I installed the INI package, however, it also defines an EditorConfig syntax, which results in two Set Syntax: EditorConfig commands.

This is quite confusing - as the two syntaxes produce different colors. This is in turn caused by different scope names.

I have compared the two, and the one from the INI package seems more developed - also stated in jwortmann/ini-syntax#16 (comment).

I propose two options to solve the issue:

  1. Update the EditorConfig syntax definition with the one in the INI package.
    After that, the INI package could drop the EditorConfig syntax definition.
    • This would require either updating the hidden INI syntax as well (to match)
    • or rather mark the INI package as a dependency - this is done with other packages as well
  2. Merge the two packages into one
    As this package has features missing from INI, like indent_style integration with SublimeText

I would prefer keeping this package separate and depending on INI for the syntax definition

Either way, it would solve the duplicate command issue.

Also, I might create a separate issue for it, should this move forward.

You are right, ideally both packages would provide independent syntaxes to avoid conflicts or duplication. EditorConfig syntax just being an INI file is probably the root cause.

That's unrelated with A File Icon however and would be resolved by those package's authors/maintainers.

I am terribly sorry - for some reason I was under the impression I am commenting under the EditorConfig.

So please disregard my previous comment - it IS unrelated, and should be resolved by the EditorConfig and INI folks.

Thanks again for the help and patience and understanding!