Syntax highlighting for desktop configuration files


#1

Hi,

I was wondering if anyone had any intention to write a package with support for syntax highlighting of desktop configuration files (file extensions: .desktop and .directory). Both GNU Emacs and Vim currently have syntax-highlighting support for these files.

Thanks for your time,
Brenton


#2

.desktop config files use the INI format. Use this package: https://atom.io/packages/language-ini
( you will have to manually change the syntax highlighting to INI in the bottom right corner of atom though. The package doesn’t specifiy .desktop or .directory to be recognized automatically)


#3

Atom now supports custom file type associations, so you could associate .desktop or .directory with the INI file syntax.


#4

And how would I do that? I read your link but that link assumed I knew which file I had to add the required changes to, which I do not.


#5

That goes into the config.cson, which you can open with the “Open Your Config” command in the Command Palette.


#6

@leedohm Ah, I just tried adding:

  core:
    customFileTypes:
      'source.ini': [
        '*.desktop'
        '*.directory'
      ]

to my config.cson script and it didn’t cause my .desktop files to be highlighted with the INI syntax. That was what I was supposed to do right, to get my .desktop files highlighted using the language-ini package?


#7

What if you drop the * and just do '.desktop' or drop both * and . and use just desktop?


#8

Not sure who of you created the accepted pull request, but for your info: .desktop and .directory are now in the INI package by default.


#9

adjusting '*.desktop' to 'desktop' and doing the same with '*.directory', worked, thanks.


#10

I’ve also tried to get XML syntax highlighting for .menu files and it isn’t working, this is the case I have in config.cson (including the INI code too, in case it is relevant):

"*":
  core:
    customFileTypes:
      'source.ini': [
        'desktop'
        'directory'
      ]
      'source.xml': [
        'menu'
      ]

#11

The scope for XML is not source.xml but text.xml: