mirror of
https://github.com/zyedidia/micro.git
synced 2026-03-29 22:27:13 +09:00
LSP option and better LSP status
This commit is contained in:
@@ -41,7 +41,7 @@ func LoadConfig(data []byte) (*Config, error) {
|
||||
return &conf, nil
|
||||
}
|
||||
|
||||
func (l *Language) Installed() bool {
|
||||
func (l Language) Installed() bool {
|
||||
_, err := exec.LookPath(l.Command)
|
||||
if err != nil {
|
||||
return false
|
||||
@@ -50,7 +50,7 @@ func (l *Language) Installed() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
func (l *Language) DoInstall(w io.Writer) error {
|
||||
func (l Language) DoInstall(w io.Writer) error {
|
||||
if l.Installed() {
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -25,12 +25,18 @@ func init() {
|
||||
}
|
||||
|
||||
func GetServer(l Language, dir string) *Server {
|
||||
return activeServers[l.Command+"-"+dir]
|
||||
s, ok := activeServers[l.Command+"-"+dir]
|
||||
if ok && s.Active {
|
||||
return s
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func ShutdownAllServers() {
|
||||
for _, s := range activeServers {
|
||||
s.Shutdown()
|
||||
if s.Active {
|
||||
s.Shutdown()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -178,6 +184,7 @@ func (s *Server) Initialize(directory string) {
|
||||
func (s *Server) Shutdown() {
|
||||
s.sendRequest(lsp.MethodShutdown, nil)
|
||||
s.sendNotification(lsp.MethodExit, nil)
|
||||
s.Active = false
|
||||
}
|
||||
|
||||
func (s *Server) receive() {
|
||||
|
||||
Reference in New Issue
Block a user