diff --git a/conf/wide.json b/conf/wide.json index a932613..8dcc030 100644 --- a/conf/wide.json +++ b/conf/wide.json @@ -21,10 +21,9 @@ "D:\\GoGoGo\\src\\github.com\\b3log\\wide\\data\\user_workspaces\\admin\\src\\mytest\\time\\pkg" ], "Files": [ - "D:\\GoGoGo\\src\\github.com\\b3log\\wide\\data\\user_workspaces\\admin\\src\\mytest\\time\\main.go", - "D:\\GoGoGo\\src\\github.com\\b3log\\wide\\data\\user_workspaces\\admin\\src\\mytest\\time\\pkg\\time.go" + "D:\\GoGoGo\\src\\github.com\\b3log\\wide\\data\\user_workspaces\\admin\\src\\mytest\\time\\main.go" ], - "CurrentFile": "D:\\GoGoGo\\src\\github.com\\b3log\\wide\\data\\user_workspaces\\admin\\src\\mytest\\time\\pkg\\time.go" + "CurrentFile": "D:\\GoGoGo\\src\\github.com\\b3log\\wide\\data\\user_workspaces\\admin\\src\\mytest\\time\\main.go" } } ] diff --git a/editor/editors.go b/editor/editors.go index 9dc89df..0b46130 100644 --- a/editor/editors.go +++ b/editor/editors.go @@ -356,6 +356,7 @@ func FindUsagesHandler(w http.ResponseWriter, r *http.Request) { ch := int(args["cursorCh"].(float64)) offset := getCursorOffset(code, line, ch) + // glog.Infof("offset [%d]", offset) // TODO: 目前是调用 liteide_stub 工具来查找使用,后续需要重新实现 ide_stub := conf.Wide.GetIDEStub() @@ -391,11 +392,11 @@ func FindUsagesHandler(w http.ResponseWriter, r *http.Request) { cursorLine, _ := strconv.Atoi(found[cursorSep+1 : strings.LastIndex(found, ":")]) cursorCh, _ := strconv.Atoi(found[strings.LastIndex(found, ":")+1:]) - usage := &file.Snippet{Path: path, Line: cursorLine, Ch: cursorCh /* TODO: 获取附近的代码片段 */} + usage := &file.Snippet{Path: path, Line: cursorLine, Ch: cursorCh, Contents: []string{""}} usages = append(usages, usage) } - data["usages"] = usages + data["founds"] = usages } // 计算光标偏移位置. diff --git a/i18n/zh_CN.json b/i18n/zh_CN.json index 3c8662e..2a15381 100644 --- a/i18n/zh_CN.json +++ b/i18n/zh_CN.json @@ -44,5 +44,7 @@ "notification": "通知", "min": "最小化", "restore_side": "左侧窗口还原", + "usages": "查找使用", + "search_text": "查找文本", "restore_bottom": "底部窗口还原" } \ No newline at end of file diff --git a/main.go b/main.go index 0da0d30..62cd886 100644 --- a/main.go +++ b/main.go @@ -149,9 +149,11 @@ func indexHandler(w http.ResponseWriter, r *http.Request) { t.Execute(w, model) } -// favicon.ico 请求处理. -func faviconHandler(w http.ResponseWriter, r *http.Request) { - // TODO: favicon.ico 请求处理 +// 单个文件资源请求处理. +func serveSingle(pattern string, filename string) { + http.HandleFunc(pattern, func(w http.ResponseWriter, r *http.Request) { + http.ServeFile(w, r, filename) + }) } // 主程序入口. @@ -160,17 +162,17 @@ func main() { defer glog.Flush() - // 静态资源 - http.Handle("/static/", http.StripPrefix("/static/", http.FileServer(http.Dir("static")))) - http.HandleFunc("/favicon.ico", handlerWrapper(faviconHandler)) - - // 库资源 - http.Handle("/data/", http.StripPrefix("/data/", http.FileServer(http.Dir("data")))) - // IDE http.HandleFunc("/login", handlerWrapper(loginHandler)) http.HandleFunc("/", handlerWrapper(indexHandler)) + // 静态资源 + http.Handle("/static/", http.StripPrefix("/static/", http.FileServer(http.Dir("static")))) + serveSingle("/favicon.ico", "./static/favicon.ico") + + // 库资源 + http.Handle("/data/", http.StripPrefix("/data/", http.FileServer(http.Dir("data")))) + // 会话 http.HandleFunc("/session/ws", handlerWrapper(session.WSHandler)) http.HandleFunc("/session/save", handlerWrapper(session.SaveContent)) diff --git a/static/css/login.css b/static/css/login.css index a2a7aff..7aec7fa 100644 --- a/static/css/login.css +++ b/static/css/login.css @@ -3,8 +3,10 @@ width: 980px; } -.header h1 { - margin: 0; +.header .logo { + float: left; + height: 32px; + margin-top: 3px; } .header { diff --git a/static/css/wide.css b/static/css/wide.css index 970e539..1be49dd 100644 --- a/static/css/wide.css +++ b/static/css/wide.css @@ -280,6 +280,31 @@ width: 50px; padding: 0 5px; } + +.bottom-window-group .search li { + cursor: pointer; + line-height: 20px; + padding: 0 3px; + word-wrap: normal; + word-break: normal; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; +} + +.bottom-window-group .search li.selected { + background-color: #3875d7; + color: #FFF; +} + +.bottom-window-group .search .path { + color: #999; + font-size: 12px; +} + +.bottom-window-group .search li.selected .path { + color: #FFF; +} /* end bottom-window-group */ /* start footer */ diff --git a/static/favicon.ico b/static/favicon.ico new file mode 100644 index 0000000..73bb45f Binary files /dev/null and b/static/favicon.ico differ diff --git a/static/images/wide-logo.png b/static/images/wide-logo.png new file mode 100644 index 0000000..02463de Binary files /dev/null and b/static/images/wide-logo.png differ diff --git a/static/js/editors.js b/static/js/editors.js index 05b51b5..bbdf980 100644 --- a/static/js/editors.js +++ b/static/js/editors.js @@ -259,38 +259,69 @@ var editors = { return; } - var usagesHTML = '