This commit is contained in:
Liang Ding 2015-08-05 11:09:52 +08:00
parent 23c924e286
commit 2ebaa98efb
1 changed files with 12 additions and 11 deletions

View File

@ -194,8 +194,8 @@ func GetExprInfoHandler(w http.ResponseWriter, r *http.Request) {
}
path := args["path"].(string)
curDir := path[:strings.LastIndex(path, conf.PathSeparator)]
filename := path[strings.LastIndex(path, conf.PathSeparator)+1:]
curDir := filepath.Dir(path)
filename := filepath.Base(path)
fout, err := os.Create(path)
@ -224,7 +224,7 @@ func GetExprInfoHandler(w http.ResponseWriter, r *http.Request) {
logger.Tracef("offset [%d]", offset)
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.Dir = curDir
@ -270,8 +270,8 @@ func FindDeclarationHandler(w http.ResponseWriter, r *http.Request) {
}
path := args["path"].(string)
curDir := path[:strings.LastIndex(path, conf.PathSeparator)]
filename := path[strings.LastIndex(path, conf.PathSeparator)+1:]
curDir := filepath.Dir(path)
filename := filepath.Base(path)
fout, err := os.Create(path)
@ -300,7 +300,7 @@ func FindDeclarationHandler(w http.ResponseWriter, r *http.Request) {
logger.Tracef("offset [%d]", offset)
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.Dir = curDir
@ -324,10 +324,11 @@ func FindDeclarationHandler(w http.ResponseWriter, r *http.Request) {
part := found[:strings.LastIndex(found, ":")]
cursorSep := strings.LastIndex(part, ":")
path = found[:cursorSep]
cursorLine, _ := strconv.Atoi(found[cursorSep+1 : strings.LastIndex(found, ":")])
cursorCh, _ := strconv.Atoi(found[strings.LastIndex(found, ":")+1:])
data["path"] = path
data["path"] = filepath.ToSlash(path)
data["cursorLine"] = cursorLine
data["cursorCh"] = cursorCh
}
@ -355,8 +356,8 @@ func FindUsagesHandler(w http.ResponseWriter, r *http.Request) {
}
filePath := args["path"].(string)
curDir := filePath[:strings.LastIndex(filePath, conf.PathSeparator)]
filename := filePath[strings.LastIndex(filePath, conf.PathSeparator)+1:]
curDir := filepath.Dir(filePath)
filename := filepath.Base(filePath)
fout, err := os.Create(filePath)
@ -384,7 +385,7 @@ func FindUsagesHandler(w http.ResponseWriter, r *http.Request) {
logger.Tracef("offset [%d]", offset)
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.Dir = curDir
@ -412,7 +413,7 @@ func FindUsagesHandler(w http.ResponseWriter, r *http.Request) {
part := found[:strings.LastIndex(found, ":")]
cursorSep := strings.LastIndex(part, ":")
path := found[:cursorSep]
path := filepath.ToSlash(found[:cursorSep])
cursorLine, _ := strconv.Atoi(found[cursorSep+1 : strings.LastIndex(found, ":")])
cursorCh, _ := strconv.Atoi(found[strings.LastIndex(found, ":")+1:])