Skip to content
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

Exclude QuickFix from dectect#filetype function #23

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Nealium
Copy link

@Nealium Nealium commented Dec 9, 2022

Fixes conflict specifically with vim-qf's QuickFix functions. QuickFix, in general, should be skipped with this function
Issue could effect other Plugins in similar situations, but this commit only solves QuickFix.

Specs:

  • Vim: Vim 9 (64bit)
  • OS: Windows 10 & Pop!_OS/Ubuntu

How to recreate

  • Install both vim-qf & django-plug
  • Goto any Django Project's view.py
  • :copen + :cclose + :copen + :cclose
    • Open/Close 2 or more times

Result:

Error detected while processing FileType Autocommands for "*"..function <SNR>7_LoadFTPlugin
  • Note: {x}_LoadFTPlugin x changes based on whatever pid vim{v}\ftplugin.vim is in :scriptnames
  • Offending command in ftplugin.vim is: legacy exe b:undo_ftplugin

With tinkering, using :make, the error message [below] also shows up

Error detected while processig QuickFixCmdPost Autocommands for "make"..function qf#OpenQuickfix[17]..fileFileType Autocommands for "*"..function <SNR>6_LoadFTPlugin:
Line: 3:
E184: No such user-defined command: Filter

Theory:

# :help undo_ftplugin 
When the user does ":setfiletype xyz" the effect of the previous filetype
should be undone.

When setting the filetype of QuickFix to qf again, it undoes all vim-qf's functions which causes vim-qf to crash.
Seeing most Plugins are designed to define functions one time, Django-Plus should avoid inadvertently removing them; especially with QuickFix which is a special case


Notes of behavior

function! djangoplus#detect#filetype(filename) abort

  " Passed with: djangoplus#detect#filetype(expand('<afile>:p')
  echom 'filename ' . a:filename

  " expanded inside the function
  echom 'expand path ' . expand('%:p')

  " filetype Output 
  echom 'filetype &l ' . &l:filetype

  " ... more stuff

endfunction
1) Opening views.py
filename            /path/to/project/app1/views.py
expand path         /path/to/project/app1/views.py
filetype &l         
2) Opening QuickFix
filename            /path/to/project/quickfix
expand path         
filetype &l         qf

Point:

This illustrates why the original empty(a:filename) isn't catching the QuickFix.


Sorry for the Duplicate :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant