vis icon indicating copy to clipboard operation
vis copied to clipboard

Filetype changes

Open Nomarian opened this issue 4 months ago • 6 comments

See commit message for changes. Overall its faster I think...? using lookup tables eliminates duplicates as well.

Do test for a bit, I only use a very limited amount of files.

There is a breaking change, ext is no longer for extensions, instead name does the same functionality

Nomarian avatar Sep 18 '25 00:09 Nomarian

I have squashed all commits into one and added a commit message to it. The result is https://git.sr.ht/~mcepl/vis/commit/1cf03a79c3b7 . What do you think?

Also, it wouldn’t hurt to add https://git.sr.ht/~mcepl/vis/commit/27ffce3c51be (originally from https://github.com/martanne/vis/pull/1243).

However, I have a question about the overall design. I have understood you that you meant to get vis mostly completely out of the filetype checking business, and it should be left to scintillua mechanism (and it would be using M.detect function from their lexer.lua). Why did you give up on the idea?

mcepl avatar Sep 18 '25 08:09 mcepl

Merge and add all of your changes, everything looks fine.

However, I have a question about the overall design. I have understood you that you meant to get vis mostly completely out of the filetype checking business, and it should be left to scintillua mechanism (and it would be using M.detect function from their lexer.lua). Why did you give up on the idea?

This started initially as that, the extensions table is exactly the same as scintilluas, I took both tables and merged them with scintilluas overwriting vis, but, all of the extensions in scintilluas detect function seem to point to a real lexer unlike vis, detection in vis points to the filetypes table so that if it has a commands or any other settings that need to be run, it can do so, So for now it seems filetypes is a table for pseudo lexers. It's already a big change, which will break everyones setup because filetype is missing a lot of tables so now if anybody has a table.insert(ftdetect.filetypes.c.ext, "c") it will error. this can be ameliorated with metatables, but this is the clean commit, I can add a new PR that won't break anybodies setups..

I do already have a branch that removes all of the duplicates and only keeps vis specific changes while using lexer.lua's detect, but I am trepidatious since I am not familiar on the code from lexer.lua, and it also does things that the Detect function already does so there's duplicate work. It also does not support checking for mime types, textadept is multiplatform so they cannot run file or check for mime types so seems like vis is stuck checking for filetypes.

https://github.com/Nomarian/vis/commit/a21f471569c33d9969092900321711b48e224292

Nomarian avatar Sep 18 '25 16:09 Nomarian

I think I'm finished, apart from your additions which you should do

Nomarian avatar Sep 19 '25 05:09 Nomarian

https://git.sr.ht/~mcepl/vis/log/1264-refactor-filetype has been updated. Should I sent it to the list for review?

mcepl avatar Sep 22 '25 00:09 mcepl

I'm still unsure about a lot of things but its good enough

Nomarian avatar Sep 22 '25 17:09 Nomarian

https://lists.sr.ht/~martanne/devel/patches/62380

mcepl avatar Sep 24 '25 09:09 mcepl