Skip to content

[WIP] support filetype tags#17

Open
nolange wants to merge 3 commits intopestilence669:masterfrom
nolange:master
Open

[WIP] support filetype tags#17
nolange wants to merge 3 commits intopestilence669:masterfrom
nolange:master

Conversation

@nolange
Copy link
Copy Markdown

@nolange nolange commented Jan 5, 2020

This should ultimately fix #2.

I would like some feedback on the current implementation.

Vim Filetypes are mapped to the internal sublime scope names

This seems to make more sense to me that depending on package names and filenames in packages.

I have some crude python scripts to pry the scope-names sublime uses and used some grep'ping to get an ideas about vims filetype tags.
Matching was again done half-automatically.

  • I only used the base Sublime 3 syntaxes and the CMake plugin, means only those are in the Vim -> scope_name map.
  • Ideally all "standard" scope names (widely used) would be added
  • The helper scripts should probably end up somewhere too.

a map of internal sublime scope names is built the first time it is used

This is the main issue, I dont know how to do this cleanly.

  • since I enumerate resources, I hope it does not depend on plugin load order.
  • multiple packages could provide the same scope_name. Dont care for that yet (probably should sort the list so its atleast deterministic)
  • probably should be done in plugin_loaded, but I don't know python and its package/class scope good enough.
  • currently needs a plugin reload to find syntax plugin thats later installed
  • I did use a plain string search since I had trouble using yaml (various syntax warnings), and I dont know if it ships with Sublime. Should be faster I guess, so thats an good excuse.

allow user customzations / extensions

Not done yet, but a map in the settings would allow to:

Override the scope name:
'cmake': 'source.cmake',
or override the package name:
'cmake': 'CMake/CMake',

The later will alwas have a / delimiter, so a single map would suffice.

Other stuff

I realized that loading the plugin will not apply in other open files (they dont have an active Window/"View" I guess)

contains a dictionary to map form vim filetype identifiers,
to the "scope" names Sublime uses in its Syntax files.
This was generated half-automatically, and scope names
cover those available in Sublime and the CMake plugin.

The mapping from Sublime's "scope" names to package names
if created the first time it is requested.

both mappings should allow changes by the user
(not implemented).

Signed-off-by: Norbert Lange <nolange79@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for filetype/ft

1 participant