-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Parenths don't auto close in swift files with swift string interpolation #84
Comments
Fixed (813e1b3) (Needs swift-treesitter-parser to detect and ignore the contents of the string) |
Is there any way to not use swift-treesitter-parser? I have it disabled because it makes my editor lag a lot in insert mode for swift files. The plugin lexima is able to do the autocomplete correctly for these swift files and it doesn't use treesitter, so it must be possible somehow. |
No (technically yes but it's a lot of work). By the way, when you say disabled, do you mean the highlighting part, or is it that you don't have the parser installed? Because ultimate-autopair only needs the parser and doesn't rely on highlighting. require'nvim-treesitter.configs'.setup({
ensure_installed = {'swift'},
highlight={enable=true, disable={'swift'}},
}) |
Yeah it's still slow even with the highlighting turned off unfortunately. I have to totally uninstall it for it to become fast again. There's a lag every time I enter into command mode when I have treesitter-swift installed, even with the syntax highlighting off :( Is there a way maybe to disable multi line autoclose for certain filetypes (Which I think is what is causing this problem)? So basically just give it the stock autoclose for a file with no syntax but disable multi line matching Edit: So I checked out this thread alex-pinkus/tree-sitter-swift#240 and figured out that disabling treesitter indent for swift fixed the lag issue, versus disabling the syntax highlight which didn't fix it. It's mostly good now! Leaving this comment in case someone else needs it I guess! |
To disable multiline on specific filetype you can: require('ultimate-autopair').setup{
multiline=function ()
return vim.o.filetype~='swift'
end
} Another solution to this is to get the highlighting (using require('ultimate-autopair').setup{
config_internal_pairs={
{'(',')',cond=function (fn,o)
if fn.get_ft()~='swift' then return true end
return vim.fn.synIDattr(vim.fn.synID(o.row,o.col,1),'name')~='swiftInterpolation'
end},
},
} |
It seems that if there is a string with swift string interpolation, this causes the plugin to break for parenths. The string interpolation syntax of swift is like this:
Here is a video of it breaking
https://streamable.com/zplv0x
Any help would be appreciated. Thanks!
The text was updated successfully, but these errors were encountered: