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

WIP: Move plugin to ftdetect,ftplugin #15

Merged
merged 2 commits into from
May 25, 2019
Merged

WIP: Move plugin to ftdetect,ftplugin #15

merged 2 commits into from
May 25, 2019

Conversation

janlazo
Copy link
Contributor

@janlazo janlazo commented May 17, 2019

Optimize startup by delaying filetype-dependent code until the user opens a powershell file.

@@ -0,0 +1 @@
autocmd BufNewFile,BufRead *.ps*1 setfiletype ps1
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I use https://github.com/PProvost/vim-ps1 so I used setfiletype here instead of set filetype. Vim doesn't detect *.ps*1 files by default so this should be fine.

endif

autocmd FileType ps1,psd1,psm1 call s:PSESSetup()
call s:PSESSetup()
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this run every time the user opens a powershell file?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no, only the first time, so if ftdetect is done properly we just need to fire it once. 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if exists('s:loaded_ftplugin')
  finish
endif
let s:loaded_ftplugin = 1
call s:PSESetup()

Treat it like a plugin then with a guard?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yup. that will do.

@yatli
Copy link
Member

yatli commented May 20, 2019

thanks @janlazo for the patch!
I didn't know much about the folders other than the usual plugin, autoload :)

@yatli
Copy link
Member

yatli commented May 20, 2019

@janlazo could you please rebase this on the latest merge? We were working on some improvements on pwsh version selection.

@yatli
Copy link
Member

yatli commented May 23, 2019

hmm, perhaps this can be merged directly.

Optimize startup by delaying filetype-dependent code
until the user opens a powershell file.
Copy link
Member

@yatli yatli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@yatli yatli merged commit 2a3a405 into coc-extensions:master May 25, 2019
@janlazo janlazo deleted the filetype branch May 25, 2019 15:11
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.

2 participants