Fix #92
This commit is contained in:
parent
0a10cf2689
commit
3b8b8ced46
|
@ -124,13 +124,15 @@ func AutocompleteHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
// glog.Infof("offset: %d", offset)
|
// glog.Infof("offset: %d", offset)
|
||||||
|
|
||||||
userWorkspace := conf.Wide.GetUserWorkspace(username)
|
userWorkspace := conf.Wide.GetUserWorkspace(username)
|
||||||
|
workspaces := strings.Split(userWorkspace, conf.PathListSeparator)
|
||||||
//glog.Infof("User [%s] workspace [%s]", username, userWorkspace)
|
libPath := ""
|
||||||
userLib := userWorkspace + conf.PathSeparator + "pkg" + conf.PathSeparator +
|
for _, workspace := range workspaces {
|
||||||
|
userLib := workspace + conf.PathSeparator + "pkg" + conf.PathSeparator +
|
||||||
runtime.GOOS + "_" + runtime.GOARCH
|
runtime.GOOS + "_" + runtime.GOARCH
|
||||||
|
libPath += userLib + conf.PathListSeparator
|
||||||
|
}
|
||||||
|
|
||||||
libPath := userLib
|
glog.V(5).Infof("gocode set lib-path %s", libPath)
|
||||||
//glog.Infof("gocode set lib-path %s", libPath)
|
|
||||||
|
|
||||||
// FIXME: 使用 gocode set lib-path 在多工作空间环境下肯定是有问题的,需要考虑其他实现方式
|
// FIXME: 使用 gocode set lib-path 在多工作空间环境下肯定是有问题的,需要考虑其他实现方式
|
||||||
gocode := conf.Wide.GetGocode()
|
gocode := conf.Wide.GetGocode()
|
||||||
|
|
|
@ -45,9 +45,24 @@ func GetFiles(w http.ResponseWriter, r *http.Request) {
|
||||||
session, _ := session.HTTPSession.Get(r, "wide-session")
|
session, _ := session.HTTPSession.Get(r, "wide-session")
|
||||||
|
|
||||||
username := session.Values["username"].(string)
|
username := session.Values["username"].(string)
|
||||||
userSrc := conf.Wide.GetUserWorkspace(username) + conf.PathSeparator + "src"
|
userWorkspace := conf.Wide.GetUserWorkspace(username)
|
||||||
|
workspaces := strings.Split(userWorkspace, conf.PathListSeparator)
|
||||||
|
|
||||||
root := FileNode{Name: "projects", Path: userSrc, IconSkin: "ico-ztree-dir ", Type: "d", FileNodes: []*FileNode{}}
|
root := FileNode{Name: "root", Path: "", IconSkin: "ico-ztree-dir ", Type: "d", FileNodes: []*FileNode{}}
|
||||||
|
|
||||||
|
// 工作空间节点处理
|
||||||
|
for _, workspace := range workspaces {
|
||||||
|
workspacePath := workspace + conf.PathSeparator + "src"
|
||||||
|
|
||||||
|
workspaceNode := FileNode{Name: workspace[strings.LastIndex(workspace, conf.PathSeparator)+1:] + " (" +
|
||||||
|
workspace + ")",
|
||||||
|
Path: workspacePath, IconSkin: "ico-ztree-dir ", Type: "d", FileNodes: []*FileNode{}}
|
||||||
|
|
||||||
|
walk(workspacePath, &workspaceNode)
|
||||||
|
|
||||||
|
// 添加工作空间节点
|
||||||
|
root.FileNodes = append(root.FileNodes, &workspaceNode)
|
||||||
|
}
|
||||||
|
|
||||||
// 构造 Go API 节点
|
// 构造 Go API 节点
|
||||||
apiPath := runtime.GOROOT() + conf.PathSeparator + "src" + conf.PathSeparator + "pkg"
|
apiPath := runtime.GOROOT() + conf.PathSeparator + "src" + conf.PathSeparator + "pkg"
|
||||||
|
@ -65,9 +80,6 @@ func GetFiles(w http.ResponseWriter, r *http.Request) {
|
||||||
close(goapiBuildOKSignal)
|
close(goapiBuildOKSignal)
|
||||||
}()
|
}()
|
||||||
|
|
||||||
// 构造用户工作空间文件树
|
|
||||||
walk(userSrc, &root)
|
|
||||||
|
|
||||||
// 等待放行
|
// 等待放行
|
||||||
<-goapiBuildOKSignal
|
<-goapiBuildOKSignal
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue