fix(ppm): Persist-PluginActivation never persists on a normal install - #34
Open
dabravin wants to merge 1 commit into
Open
fix(ppm): Persist-PluginActivation never persists on a normal install#34dabravin wants to merge 1 commit into
dabravin wants to merge 1 commit into
Conversation
…n line Persist-PluginActivation's "already exists" check matched on the bare plugin name anywhere in the config file, via [regex]::Escape($name). Since the documented install flow requires the user to already have `set -g @plugin 'org/name'` in their config before Prefix+I attempts installation, that declaration line always already contains $name - so the check matched it on every fresh install and returned early before ever appending the real source-file/run-shell activation line. Net effect: plugins that ship a plugin.conf or matching .ps1 never get their activation persisted via the normal install flow, so they don't load automatically on the next server start (users have to notice and hand-add the source-file line themselves). Fix: check for the literal $activationLine string instead of the bare plugin name, since that line is already fully computed by this point and won't accidentally match the plugin's own @plugin declaration.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Persist-PluginActivation's "already exists" check matches on the bare plugin name anywhere in.psmux.conf, via[regex]::Escape($name). The documented install flow requires the user to already haveset -g @plugin 'org/name'in their config beforePrefix+Iattempts installation - so that declaration line always already contains$nameby the time this check runs. The check matches it immediately and returns early, before ever appending the realsource-file/run-shellactivation line.Net effect: any plugin that ships a
plugin.confor a matching.ps1entry point never gets its activation persisted via the normal, documented install flow (set -g @plugin ...+Prefix+I). It has to be noticed and hand-fixed by adding thesource-fileline yourself - the exact thing this function exists to automate.Fix
Check for the literal
$activationLinestring (already fully computed earlier in the function) instead of the bare plugin name. That string is specific enough (source-file '~/.psmux/plugins/<name>/plugin.conf'orrun-shell '...') that it won't accidentally match the plugin's own@plugindeclaration line, while still correctly detecting a genuinely-already-persisted activation line on a second install attempt.Test plan
@plugin 'psmux-plugins/psmux-resurrect', delete any existing plugin dir, runPrefix+I- nosource-fileline gets added to.psmux.conf, confirmed via direct file inspection before/after.@plugindeclaration.[scriptblock]::Createparse check).Prefix+Ikeybinding path itself, only the underlying function logic.