A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/JohnnyMorganz/StyLua/issues/962 below:

[Bug] Syntax error with Label after assignment · Issue #962 · JohnnyMorganz/StyLua · GitHub

In vim:

:!stylua /home/priz/.config/nvim/lua/priz-lsp/init.lua                                                                                                                                                                                                                                                          
error: could not format file /home/priz/.config/nvim/lua/priz-lsp/init.lua: error parsing: unexpected token `end` (17:14 to 18:6), expected label name after `::`                                                                                                                                                         
                                                                                                                                                                                                                                                                                                                          
shell returned 2                                                                                                                                                                                                                                                                                                          

Relevant code:

vim.debug = {
	nvim_win_get_all_options = function(winid)
		local all_options = vim.api.nvim_get_all_options_info()
		local opts = vim.wo[winid]
		local ret = {}
		for k, _ in pairs(all_options) do
			local opt = opts[k] ---@type vim.api.keyset.get_option_info
			if opt == nil then
				goto continue
			elseif opt.scope ~= "win" then
				goto continue
			elseif opt.global_local == false then
				goto continue
			end

			ret[k] = opts[k]
			::continue::
		end

		return ret
	end,
}

Any labels after assignment will raise a syntax error in Stylua. In order for this to work, I need to add a generic call (eg vim.print("hi")), or wrap ret[k] = opts[k] in a do/end block.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4