@@ -42,6 +42,7 @@ type PluginPackage struct {
4242 Author string
4343 Tags []string
4444 Versions PluginVersions
45+ Builtin bool
4546}
4647
4748// PluginPackages is a list of PluginPackage instances.
@@ -75,6 +76,9 @@ func (pp *PluginPackage) String() string {
7576 buf := new (bytes.Buffer )
7677 buf .WriteString ("Plugin: " )
7778 buf .WriteString (pp .Name )
79+ if pp .Builtin {
80+ buf .WriteString (" (built-in)" )
81+ }
7882 buf .WriteRune ('\n' )
7983 if pp .Author != "" {
8084 buf .WriteString ("Author: " )
@@ -334,7 +338,7 @@ func isUnknownCoreVersion() bool {
334338 return err != nil
335339}
336340
337- func newStaticPluginVersion (name , version string ) * PluginVersion {
341+ func newStaticPluginVersion (name , version string , builtin bool ) * PluginVersion {
338342 vers , err := semver .ParseTolerant (version )
339343
340344 if err != nil {
@@ -343,7 +347,8 @@ func newStaticPluginVersion(name, version string) *PluginVersion {
343347 }
344348 }
345349 pl := & PluginPackage {
346- Name : name ,
350+ Name : name ,
351+ Builtin : builtin ,
347352 }
348353 pv := & PluginVersion {
349354 pack : pl ,
@@ -358,15 +363,15 @@ func newStaticPluginVersion(name, version string) *PluginVersion {
358363func GetInstalledVersions (withCore bool ) PluginVersions {
359364 result := PluginVersions {}
360365 if withCore {
361- result = append (result , newStaticPluginVersion (CorePluginName , util .Version ))
366+ result = append (result , newStaticPluginVersion (CorePluginName , util .Version , true ))
362367 }
363368
364369 for _ , p := range Plugins {
365370 if ! p .IsLoaded () {
366371 continue
367372 }
368373 version := GetInstalledPluginVersion (p .Name )
369- if pv := newStaticPluginVersion (p .Name , version ); pv != nil {
374+ if pv := newStaticPluginVersion (p .Name , version , p . Builtin ); pv != nil {
370375 result = append (result , pv )
371376 }
372377 }
@@ -604,7 +609,7 @@ func UpdatePlugins(out io.Writer, plugins []string) {
604609 // if no plugins are specified, update all installed plugins.
605610 if len (plugins ) == 0 {
606611 for _ , p := range Plugins {
607- if ! p .IsLoaded () || p .Default {
612+ if ! p .IsLoaded () || p .Builtin {
608613 continue
609614 }
610615 plugins = append (plugins , p .Name )
@@ -613,7 +618,7 @@ func UpdatePlugins(out io.Writer, plugins []string) {
613618
614619 fmt .Fprintln (out , "Checking for plugin updates" )
615620 microVersion := PluginVersions {
616- newStaticPluginVersion (CorePluginName , util .Version ),
621+ newStaticPluginVersion (CorePluginName , util .Version , true ),
617622 }
618623
619624 var updates = make (PluginDependencies , 0 )
@@ -665,7 +670,7 @@ func PluginCommand(out io.Writer, cmd string, args []string) {
665670 for _ , plugin := range args {
666671 // check if the plugin exists.
667672 for _ , p := range Plugins {
668- if p .Name == plugin && p .Default {
673+ if p .Name == plugin && p .Builtin {
669674 fmt .Fprintln (out , "Default plugins cannot be removed, but can be disabled via settings." )
670675 continue
671676 }
@@ -687,7 +692,13 @@ func PluginCommand(out io.Writer, cmd string, args []string) {
687692 plugins := GetInstalledVersions (false )
688693 fmt .Fprintln (out , "The following plugins are currently installed:" )
689694 for _ , p := range plugins {
690- fmt .Fprintf (out , "%s (%s)\n " , p .Pack ().Name , p .Version )
695+ if p .Pack ().Name == "initlua" {
696+ fmt .Fprintf (out , "initlua\n " )
697+ } else if p .Pack ().Builtin {
698+ fmt .Fprintf (out , "%s (built-in)\n " , p .Pack ().Name )
699+ } else {
700+ fmt .Fprintf (out , "%s (%s)\n " , p .Pack ().Name , p .Version )
701+ }
691702 }
692703 case "search" :
693704 plugins := SearchPlugin (out , args )
0 commit comments