This commit is contained in:
parent
23c924e286
commit
2ebaa98efb
|
@ -194,8 +194,8 @@ func GetExprInfoHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
}
|
}
|
||||||
|
|
||||||
path := args["path"].(string)
|
path := args["path"].(string)
|
||||||
curDir := path[:strings.LastIndex(path, conf.PathSeparator)]
|
curDir := filepath.Dir(path)
|
||||||
filename := path[strings.LastIndex(path, conf.PathSeparator)+1:]
|
filename := filepath.Base(path)
|
||||||
|
|
||||||
fout, err := os.Create(path)
|
fout, err := os.Create(path)
|
||||||
|
|
||||||
|
@ -224,7 +224,7 @@ func GetExprInfoHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
logger.Tracef("offset [%d]", offset)
|
logger.Tracef("offset [%d]", offset)
|
||||||
|
|
||||||
ideStub := util.Go.GetExecutableInGOBIN("ide_stub")
|
ideStub := util.Go.GetExecutableInGOBIN("ide_stub")
|
||||||
argv := []string{"type", "-cursor", filename + ":" + strconv.Itoa(offset), "-info", "."}
|
argv := []string{"types", "-pos", filename + ":" + strconv.Itoa(offset), "-info", "."}
|
||||||
cmd := exec.Command(ideStub, argv...)
|
cmd := exec.Command(ideStub, argv...)
|
||||||
cmd.Dir = curDir
|
cmd.Dir = curDir
|
||||||
|
|
||||||
|
@ -270,8 +270,8 @@ func FindDeclarationHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
}
|
}
|
||||||
|
|
||||||
path := args["path"].(string)
|
path := args["path"].(string)
|
||||||
curDir := path[:strings.LastIndex(path, conf.PathSeparator)]
|
curDir := filepath.Dir(path)
|
||||||
filename := path[strings.LastIndex(path, conf.PathSeparator)+1:]
|
filename := filepath.Base(path)
|
||||||
|
|
||||||
fout, err := os.Create(path)
|
fout, err := os.Create(path)
|
||||||
|
|
||||||
|
@ -300,7 +300,7 @@ func FindDeclarationHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
logger.Tracef("offset [%d]", offset)
|
logger.Tracef("offset [%d]", offset)
|
||||||
|
|
||||||
ideStub := util.Go.GetExecutableInGOBIN("ide_stub")
|
ideStub := util.Go.GetExecutableInGOBIN("ide_stub")
|
||||||
argv := []string{"type", "-cursor", filename + ":" + strconv.Itoa(offset), "-def", "."}
|
argv := []string{"types", "-pos", filename + ":" + strconv.Itoa(offset), "-def", "."}
|
||||||
cmd := exec.Command(ideStub, argv...)
|
cmd := exec.Command(ideStub, argv...)
|
||||||
cmd.Dir = curDir
|
cmd.Dir = curDir
|
||||||
|
|
||||||
|
@ -324,10 +324,11 @@ func FindDeclarationHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
part := found[:strings.LastIndex(found, ":")]
|
part := found[:strings.LastIndex(found, ":")]
|
||||||
cursorSep := strings.LastIndex(part, ":")
|
cursorSep := strings.LastIndex(part, ":")
|
||||||
path = found[:cursorSep]
|
path = found[:cursorSep]
|
||||||
|
|
||||||
cursorLine, _ := strconv.Atoi(found[cursorSep+1 : strings.LastIndex(found, ":")])
|
cursorLine, _ := strconv.Atoi(found[cursorSep+1 : strings.LastIndex(found, ":")])
|
||||||
cursorCh, _ := strconv.Atoi(found[strings.LastIndex(found, ":")+1:])
|
cursorCh, _ := strconv.Atoi(found[strings.LastIndex(found, ":")+1:])
|
||||||
|
|
||||||
data["path"] = path
|
data["path"] = filepath.ToSlash(path)
|
||||||
data["cursorLine"] = cursorLine
|
data["cursorLine"] = cursorLine
|
||||||
data["cursorCh"] = cursorCh
|
data["cursorCh"] = cursorCh
|
||||||
}
|
}
|
||||||
|
@ -355,8 +356,8 @@ func FindUsagesHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
}
|
}
|
||||||
|
|
||||||
filePath := args["path"].(string)
|
filePath := args["path"].(string)
|
||||||
curDir := filePath[:strings.LastIndex(filePath, conf.PathSeparator)]
|
curDir := filepath.Dir(filePath)
|
||||||
filename := filePath[strings.LastIndex(filePath, conf.PathSeparator)+1:]
|
filename := filepath.Base(filePath)
|
||||||
|
|
||||||
fout, err := os.Create(filePath)
|
fout, err := os.Create(filePath)
|
||||||
|
|
||||||
|
@ -384,7 +385,7 @@ func FindUsagesHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
logger.Tracef("offset [%d]", offset)
|
logger.Tracef("offset [%d]", offset)
|
||||||
|
|
||||||
ideStub := util.Go.GetExecutableInGOBIN("ide_stub")
|
ideStub := util.Go.GetExecutableInGOBIN("ide_stub")
|
||||||
argv := []string{"type", "-cursor", filename + ":" + strconv.Itoa(offset), "-use", "."}
|
argv := []string{"types", "-pos", filename + ":" + strconv.Itoa(offset), "-use", "."}
|
||||||
cmd := exec.Command(ideStub, argv...)
|
cmd := exec.Command(ideStub, argv...)
|
||||||
cmd.Dir = curDir
|
cmd.Dir = curDir
|
||||||
|
|
||||||
|
@ -412,7 +413,7 @@ func FindUsagesHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
|
|
||||||
part := found[:strings.LastIndex(found, ":")]
|
part := found[:strings.LastIndex(found, ":")]
|
||||||
cursorSep := strings.LastIndex(part, ":")
|
cursorSep := strings.LastIndex(part, ":")
|
||||||
path := found[:cursorSep]
|
path := filepath.ToSlash(found[:cursorSep])
|
||||||
cursorLine, _ := strconv.Atoi(found[cursorSep+1 : strings.LastIndex(found, ":")])
|
cursorLine, _ := strconv.Atoi(found[cursorSep+1 : strings.LastIndex(found, ":")])
|
||||||
cursorCh, _ := strconv.Atoi(found[strings.LastIndex(found, ":")+1:])
|
cursorCh, _ := strconv.Atoi(found[strings.LastIndex(found, ":")+1:])
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue