UTI registrations are wrong
Instructions: Replace the template text and remove irrelevant text (including this line)
Describe the bug The registration of UTIs in Info.plist is done wrong. This messes up the launch services database for the users, which can lead to all kind of problems when handling files, not just in MacVim, but any app that may need to handle any of the types declared by MacVim. In particular, the Exported Types should only contain custom types owned by MacVim. All third party types and built in types should only be declared as Imported Types. Otherwise MacVim takes ownership of them, overruling the true owners of the type, which is extremely rude. In fact, standard built-in types should not be declared at all, in particular types starting with public. What is worse, MacVim declares some types with errors. In particular, com.adobe.postscript is declared as inheriting from public.plain-text. This is absolutely wrong, as PostScript it is not plain text. It only inherits from public.data. This makes the postscript type unusable for any app that wants to use the type, and breaks the system of your users.
Environment (please complete the following information):
- Vim version 8.2.2156
Additional context Add any other context about the problem here.
Yeah I think this is the same as #916. This should probably be fixed as this as it's kind of broken. I'll look into this.
I’ve taken a look at this. The available documentation for Uniform Type Identifiers appears to be the out of date Uniform Type Identifiers Overview, the out of date System Declared Uniform Type Identifiers and the up to date Uniform Type Identifiers Framework Documentation. The gist is this. An app should export a type only if it is the source of the type; any other types it must import. The system declares various types by default, which the app doesn’t need to import.
Note that The list of system declared types in the document linked above is for OS X 10.4, and is quite out of date (10.4 saw its last release in 2007). macOS now exports additional many additional types, of which public.fortran-{,77-,90-,95-}source, public.ada-source, public.yacc-source and public.pascal-source are relevant to MacVim.
Resetting, seeding and display the type identifiers database on your machine can done with the lsregister program, which lives at /System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister. For example, to get a list of the declared types on your machine, run lsregister -dump | grep uti: | cut -c 29- | sort | uniq.
MacVim currently exports 75 type identifiers. I’ve listed these type identifiers below along with proposed changes for most of them. I’m not sure what to do with .cfg, .ini and .io files, as these are just common file extensions used for different purposes by different apps and programs, and I’m not sure what to do with .cdfg, .v, .vh, .vhdl, .scm and .gtd files as it’s just not clear to me what these file types are.
I’m happy to submit a pull request with the relevant changes once we’ve figured out what should be done with all these type identifiers.
| Current (exported) | Proposed |
|---|---|
| org.vim.vim-script | export org.vim.vim-script |
| public.plain-text | system declared |
| org.vim.tex-file | import org.tug.tex-source |
| public.c-header | system declared |
| org.vim.pch-file | system declared public.precompiled-c-header |
| public.c-plus-plus-header | system declared |
| org.vim.pch++-file | system declared public.precompiled-c-plus-plus-header |
| public.c-source | system declared |
| public.objective-c-source | system declared |
| public.objective-c-plus-plus-source | system declared |
| public.c-plus-plus-source | system declared |
| public.assembly-source | system declared |
| com.apple.rez-source | system declared |
| com.sun.java-source | system declared |
| com.apple.xcode.lex-source | system declared public.lex-source |
| com.apple.xcode.yacc-source | system declared public.yacc-source |
| public.mig-source | system declared |
| com.apple.symbol-export | system declared |
| com.apple.xcode.fortran-source | system declared public.fortran-{,77-,90-,95-}source |
| com.apple.xcode.pascal-source | system declared public.pascal-source |
| com.apple.xcode.ada-source | system declared public.ada-source |
| public.html | system declared |
| public.xml | system declared |
| com.netscape.javascript-source | system declared |
| public.perl-script | system declared |
| public.python-script | system declared |
| public.php-script | system declared |
| public.ruby-script | system declared |
| public.shell-script | system declared |
| com.sun.java-class | system declared |
| org.vim.patch-file | system declared public.patch-file |
| com.apple.xcode.strings-text | import com.apple.xcode.strings-text |
| com.apple.applescript.text | system declared |
| org.vim.as-file | import com.adobe.action-script |
| org.vim.asp-file | import com.microsoft.active-server-pages-script |
| org.vim.aspx-file | import com.microsoft.active-server-pages-script |
| org.vim.bib-file | import org.tug.bib |
| org.vim.cs-file | import com.microsoft.c-sharp-source |
| org.vim.cdfg-file | |
| org.vim.csv-file | system declared public.comma-separated-values-text |
| org.vim.tsv-file | system declared public.tab-separated-values-text |
| org.vim.cgi-file | import org.ietf.common-gateway-interface-source |
| org.vim.cfg-file | |
| org.vim.css-file | system declared public.css |
| org.vim.dtd-file | import org.w3.document-type-definition-text |
| org.vim.dylan-file | import org.opendylan.dylan-soure |
| org.vim.erl-file | import org.erlang.erlang-source |
| org.vim.f-script-file | |
| org.vim.hs-file | org.haskell.haskell-source |
| org.vim.inc-file | |
| org.vim.ics-file | system-declared com.apple.ical.ics |
| org.vim.ini-file | |
| org.vim.io-file | |
| org.vim.bsh-file | org.beanshell.beanshell-script |
| org.vim.properties-file | |
| org.vim.jsp-file | com.sun.jakarta-server-pages-source |
| org.vim.lisp-file | |
| org.vim.log-file | system declared public.log |
| org.vim.wiki-file | export org.vim.vim-wiki-text |
| com.adobe.postscript | system declared |
| org.vim.scm-file | |
| org.vim.sql-file | import org.iso.structured-query-language-source |
| org.vim.tcl-file | import tk.tcl.tcl-script |
| org.vim.xsl-file | import org.w3.extensible-style-sheet-source |
| public.vcard | system declared |
| org.vim.vb-file | import com.microsoft.visual-basic-source |
| org.vim.yaml-file | org.yaml.yaml-text |
| org.vim.gtd-file | |
| net.darlingfireball.markdown | import net.darlingfireball.markdown |
| org.vim.rst-file | import org.python.restructuredtext |
| org.vim.vba-file | import com.microsoft.visual-basic-source |
| org.vim.vhdl-file | |
| org.lua.lua-source | import org.lua.lua-source |
| org.vim.v-file | |
| org.vim.vh-file |
On 7 Aug 2023, at 04:14, Jacques van Wyk @.***> wrote:
I’ve taken a look at this. The available documentation for Uniform Type Identifiers appears to be the out of date Uniform Type Identifiers Overview https://developer.apple.com/library/archive/documentation/FileManagement/Conceptual/understanding_utis/understand_utis_intro/understand_utis_intro.html#//apple_ref/doc/uid/TP40001319-CH201-SW1, the out of date System Declared Uniform Type Identifiers https://developer.apple.com/library/archive/documentation/Miscellaneous/Reference/UTIRef/Articles/System-DeclaredUniformTypeIdentifiers.html#//apple_ref/doc/uid/TP40009259 and the up to date Uniform Type Identifiers Framework Documentation https://developer.apple.com/documentation/uniformtypeidentifiers. The gist is this. An app should export a type only if it is the source of the type; any other types it must import. The system declares various types by default, which the app doesn’t need to import.
Note that The list of system declared types in the document linked above is for OS X 10.4, and is quite out of date (10.4 saw its last release in 2007). macOS now exports additional many additional types, of which public.fortran-{,77-,90-,95-}source, public.ada-source, public.yacc-source and public.pascal-source are relevant to MacVim.
Resetting, seeding and display the type identifiers database on your machine can done with the lsregister program, which lives at /System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister. For example, to get a list of the declared types on your machine, run lsregister -dump | grep uti: | cut -c 29- | sort | uniq.
MacVim currently exports 75 type identifiers, only one of which it has the right to export (org.vim.vim-script). I’ve listed these type identifiers below along with proposed changes for most of them. I’m not sure what to do with .cfg, .ini and .io files, as these are just common file extensions used for different purposes by different apps and programs, and I’m not sure what to do with .cdfg, .v, .vh, .vhdl, .scm and .gtd files as it’s just not clear to me what these file types are.
I’m happy to submit a pull request with the relevant changes once we’ve figured out what should be done with all these type identifiers.
Current (exported) Proposed org.vim.vim-script export org.vim.vim-script public.plain-text system declared org.vim.tex-file import org.tug.tex-source public.c-header system declared org.vim.pch-file system declared public.precompiled-c-header public.c-plus-plus-header system declared org.vim.pch++-file system declared public.precompiled-c-plus-plus-header public.c-source system declared public.objective-c-source system declared public.objective-c-plus-plus-source system declared public.c-plus-plus-source system declared public.assembly-source system declared com.apple.rez-source system declared com.sun.java-source system declared com.apple.xcode.lex-source system declared public.lex-source com.apple.xcode.yacc-source system declared public.yacc-source public.mig-source system declared com.apple.symbol-export system declared com.apple.xcode.fortran-source system declared public.fortran-{,77-,90-,95-}source com.apple.xcode.pascal-source system declared public.pascal-source com.apple.xcode.ada-source system declared public.ada-source public.html system declared public.xml system declared com.netscape.javascript-source system declared public.perl-script system declared public.python-script system declared public.php-script system declared public.ruby-script system declared public.shell-script system declared com.sun.java-class system declared org.vim.patch-file system declared public.patch-file com.apple.xcode.strings-text import com.apple.xcode.strings-text com.apple.applescript.text system declared org.vim.as-file import com.adobe.action-script org.vim.asp-file import com.microsoft.active-server-pages-script org.vim.aspx-file import com.microsoft.active-server-pages-script org.vim.bib-file import org.tug.bib org.vim.cs-file import com.microsoft.c-sharp-source org.vim.cdfg-file org.vim.csv-file system declared public.comma-separated-values-text org.vim.tsv-file system declared public.tab-separated-values-text org.vim.cgi-file import org.ietf.common-gateway-interface-source org.vim.cfg-file org.vim.css-file system declared public.css org.vim.dtd-file import org.w3.document-type-definition-text org.vim.dylan-file import org.opendylan.dylan-soure org.vim.erl-file import org.erlang.erlang-source org.vim.f-script-file org.vim.hs-file org.haskell.haskell-source org.vim.inc-file org.vim.ics-file system-declared com.apple.ical.ics org.vim.ini-file org.vim.io-file org.vim.bsh-file org.beanshell.beanshell-script org.vim.properties-file org.vim.jsp-file com.sun.jakarta-server-pages-source org.vim.lisp-file org.vim.log-file system declared public.log org.vim.wiki-file export org.vim.vim-wiki-text com.adobe.postscript system declared org.vim.scm-file org.vim.sql-file import org.iso.structured-query-language-source org.vim.tcl-file import tk.tcl.tcl-script org.vim.xsl-file import org.w3.extensible-style-sheet-source public.vcard system declared org.vim.vb-file import com.microsoft.visual-basic-source org.vim.yaml-file org.yaml.yaml-text org.vim.gtd-file net.darlingfireball.markdown import net.darlingfireball.markdown org.vim.rst-file import org.python.restructuredtext org.vim.vba-file import com.microsoft.visual-basic-source org.vim.vhdl-file org.lua.lua-source import org.lua.lua-source org.vim.v-file org.vim.vh-file — Reply to this email directly, view it on GitHub https://github.com/macvim-dev/macvim/issues/1169#issuecomment-1667086499, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAI47JHY73V66U6ZTEKPZXLXUBFR3ANCNFSM4WR6JRCQ. You are receiving this because you authored the thread.
Can I make two corrections to this list? For the (proposed) org.tug UTIs, please use one that are consistent with other apps: org.tug.tex for .tex files and org.tug.tex.bibtex for .bib files.
Christiaan