LSP option and better LSP status

This commit is contained in:
Zachary Yedidia
2020-08-12 21:40:20 -04:00
parent c822a16596
commit 25f65a5f7b
8 changed files with 43 additions and 7 deletions

View File

@@ -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
}

View File

@@ -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() {