🎨 Add plugin name to command palette https://github.com/siyuan-note/siyuan/issues/8644
This commit is contained in:
parent
d94893f9a6
commit
ba3f5fe5e5
2 changed files with 6 additions and 3 deletions
|
@ -108,7 +108,7 @@ func Plugins(frontend string) (plugins []*Plugin) {
|
|||
return
|
||||
}
|
||||
|
||||
func IsIncompatibleInstalledPlugin(name, frontend string) (found, incompatible bool) {
|
||||
func ParseInstalledPlugin(name, frontend string) (found bool, displayName string, incompatible bool) {
|
||||
pluginsPath := filepath.Join(util.DataDir, "plugins")
|
||||
if !util.IsPathRegularDirOrSymlinkDir(pluginsPath) {
|
||||
return
|
||||
|
@ -135,6 +135,7 @@ func IsIncompatibleInstalledPlugin(name, frontend string) (found, incompatible b
|
|||
}
|
||||
|
||||
found = true
|
||||
displayName = getPreferredName(plugin.Package)
|
||||
incompatible = isIncompatiblePlugin(plugin, frontend)
|
||||
}
|
||||
return
|
||||
|
|
|
@ -32,6 +32,7 @@ import (
|
|||
// Petal represents a plugin's management status.
|
||||
type Petal struct {
|
||||
Name string `json:"name"` // Plugin name
|
||||
DisplayName string `json:"displayName"` // Plugin display name
|
||||
Enabled bool `json:"enabled"` // Whether enabled
|
||||
Incompatible bool `json:"incompatible"` // Whether incompatible
|
||||
|
||||
|
@ -43,7 +44,7 @@ type Petal struct {
|
|||
func SetPetalEnabled(name string, enabled bool, frontend string) (ret *Petal, err error) {
|
||||
petals := getPetals()
|
||||
|
||||
found, incompatible := bazaar.IsIncompatibleInstalledPlugin(name, frontend)
|
||||
found, displayName, incompatible := bazaar.ParseInstalledPlugin(name, frontend)
|
||||
if !found {
|
||||
logging.LogErrorf("plugin [%s] not found", name)
|
||||
return
|
||||
|
@ -56,6 +57,7 @@ func SetPetalEnabled(name string, enabled bool, frontend string) (ret *Petal, er
|
|||
}
|
||||
petals = append(petals, ret)
|
||||
}
|
||||
ret.DisplayName = displayName
|
||||
ret.Enabled = enabled
|
||||
ret.Incompatible = incompatible
|
||||
|
||||
|
@ -78,7 +80,7 @@ func LoadPetals(frontend string) (ret []*Petal) {
|
|||
|
||||
petals := getPetals()
|
||||
for _, petal := range petals {
|
||||
_, petal.Incompatible = bazaar.IsIncompatibleInstalledPlugin(petal.Name, frontend)
|
||||
_, petal.DisplayName, petal.Incompatible = bazaar.ParseInstalledPlugin(petal.Name, frontend)
|
||||
if !petal.Enabled || petal.Incompatible {
|
||||
continue
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue