diff --git a/runtime/indent/typescript.vim b/runtime/indent/typescript.vim index e26750b8aa..7eaa9b4648 100644 --- a/runtime/indent/typescript.vim +++ b/runtime/indent/typescript.vim @@ -3,6 +3,7 @@ " Maintainer: See https://github.com/HerringtonDarkholme/yats.vim " Last Change: 2019 Oct 18 " 2023 Aug 28 by Vim Project (undo_indent) +" 2025 Jun 05 by Vim Project (remove Fixedgq() formatexp, #17452) " Acknowledgement: Based off of vim-ruby maintained by Nikolai Weibull http://vim-ruby.rubyforge.org " 0. Initialization {{{1 @@ -18,10 +19,9 @@ setlocal nosmartindent " Now, set up our indentation expression and keys that trigger it. setlocal indentexpr=GetTypescriptIndent() -setlocal formatexpr=Fixedgq(v:lnum,v:count) setlocal indentkeys=0{,0},0),0],0\,,!^F,o,O,e -let b:undo_indent = "setlocal formatexpr< indentexpr< indentkeys< smartindent<" +let b:undo_indent = "setlocal indentexpr< indentkeys< smartindent<" " Only define the function once. if exists("*GetTypescriptIndent") @@ -443,64 +443,3 @@ endfunction let &cpo = s:cpo_save unlet s:cpo_save - -function! Fixedgq(lnum, count) - let l:tw = &tw ? &tw : 80 - - let l:count = a:count - let l:first_char = indent(a:lnum) + 1 - - if mode() == 'i' " gq was not pressed, but tw was set - return 1 - endif - - " This gq is only meant to do code with strings, not comments - if s:IsLineComment(a:lnum, l:first_char) || s:IsInMultilineComment(a:lnum, l:first_char) - return 1 - endif - - if len(getline(a:lnum)) < l:tw && l:count == 1 " No need for gq - return 1 - endif - - " Put all the lines on one line and do normal splitting after that - if l:count > 1 - while l:count > 1 - let l:count -= 1 - normal J - endwhile - endif - - let l:winview = winsaveview() - - call cursor(a:lnum, l:tw + 1) - let orig_breakpoint = searchpairpos(' ', '', '\.', 'bcW', '', a:lnum) - call cursor(a:lnum, l:tw + 1) - let breakpoint = searchpairpos(' ', '', '\.', 'bcW', s:skip_expr, a:lnum) - - " No need for special treatment, normal gq handles edgecases better - if breakpoint[1] == orig_breakpoint[1] - call winrestview(l:winview) - return 1 - endif - - " Try breaking after string - if breakpoint[1] <= indent(a:lnum) - call cursor(a:lnum, l:tw + 1) - let breakpoint = searchpairpos('\.', '', ' ', 'cW', s:skip_expr, a:lnum) - endif - - - if breakpoint[1] != 0 - call feedkeys("r\") - else - let l:count = l:count - 1 - endif - - " run gq on new lines - if l:count == 1 - call feedkeys("gqq") - endif - - return 0 -endfunction