Open gadzbi123 opened 1 month ago
Hi, I ran into the issue when I was trying to specify the filetype I want when I create a new file. My configuration looks like this:
{ "LintaoAmons/scratch.nvim", config = function() require("scratch").setup({ filetypes = { "md", "txt" }, filetype_details = { js = {}, -- JS FIRST go = { -- GO SECOND requireDir = true, filename = "main", content = { "package main", "", "func main() {", " ", "}" }, cursor = { location = { 4, 2 }, insert_mode = false, }, }, }, }) end, event = "VeryLazy", },
but the output of the when I run :Scratch returns wrong order of filetype (go first and js second) like so:
:Scratch
Select filetype 1: md 2: txt 3: go -- GO FIRST 4: js -- JS SECOND 5: MANUAL_INPUT
I looked at the code, but I am not very fimiliar with lua. isn't it a mistake to put pairs() instead of ipairs() like above? https://github.com/LintaoAmons/scratch.nvim/blob/0c3badbc8b1fbe31ed5b422ba8f5c66ea6f7a9bf/lua/scratch/api.lua#L106
pairs()
ipairs()
For me it is not a huge problem to change the order, but I wander if it is not a bug?
I didn't do anything special to keep the order of the filetypes
So right now I would say the order of the filetypes is relatively arbitrary~
Hi, I ran into the issue when I was trying to specify the filetype I want when I create a new file. My configuration looks like this:
but the output of the when I run
:Scratch
returns wrong order of filetype (go first and js second) like so:I looked at the code, but I am not very fimiliar with lua. isn't it a mistake to put
pairs()
instead ofipairs()
like above? https://github.com/LintaoAmons/scratch.nvim/blob/0c3badbc8b1fbe31ed5b422ba8f5c66ea6f7a9bf/lua/scratch/api.lua#L106For me it is not a huge problem to change the order, but I wander if it is not a bug?