parent
3b421b5d0b
commit
05c296e723
|
@ -21,10 +21,9 @@
|
||||||
"D:\\GoGoGo\\src\\github.com\\b3log\\wide\\data\\user_workspaces\\admin\\src\\mytest\\time\\pkg"
|
"D:\\GoGoGo\\src\\github.com\\b3log\\wide\\data\\user_workspaces\\admin\\src\\mytest\\time\\pkg"
|
||||||
],
|
],
|
||||||
"Files": [
|
"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\\main.go"
|
||||||
"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\\pkg\\time.go"
|
"CurrentFile": "D:\\GoGoGo\\src\\github.com\\b3log\\wide\\data\\user_workspaces\\admin\\src\\mytest\\time\\main.go"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
|
@ -356,6 +356,7 @@ func FindUsagesHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
ch := int(args["cursorCh"].(float64))
|
ch := int(args["cursorCh"].(float64))
|
||||||
|
|
||||||
offset := getCursorOffset(code, line, ch)
|
offset := getCursorOffset(code, line, ch)
|
||||||
|
// glog.Infof("offset [%d]", offset)
|
||||||
|
|
||||||
// TODO: 目前是调用 liteide_stub 工具来查找使用,后续需要重新实现
|
// TODO: 目前是调用 liteide_stub 工具来查找使用,后续需要重新实现
|
||||||
ide_stub := conf.Wide.GetIDEStub()
|
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, ":")])
|
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:])
|
||||||
|
|
||||||
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)
|
usages = append(usages, usage)
|
||||||
}
|
}
|
||||||
|
|
||||||
data["usages"] = usages
|
data["founds"] = usages
|
||||||
}
|
}
|
||||||
|
|
||||||
// 计算光标偏移位置.
|
// 计算光标偏移位置.
|
||||||
|
|
|
@ -44,5 +44,7 @@
|
||||||
"notification": "通知",
|
"notification": "通知",
|
||||||
"min": "最小化",
|
"min": "最小化",
|
||||||
"restore_side": "左侧窗口还原",
|
"restore_side": "左侧窗口还原",
|
||||||
|
"usages": "查找使用",
|
||||||
|
"search_text": "查找文本",
|
||||||
"restore_bottom": "底部窗口还原"
|
"restore_bottom": "底部窗口还原"
|
||||||
}
|
}
|
22
main.go
22
main.go
|
@ -149,9 +149,11 @@ func indexHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
t.Execute(w, model)
|
t.Execute(w, model)
|
||||||
}
|
}
|
||||||
|
|
||||||
// favicon.ico 请求处理.
|
// 单个文件资源请求处理.
|
||||||
func faviconHandler(w http.ResponseWriter, r *http.Request) {
|
func serveSingle(pattern string, filename string) {
|
||||||
// TODO: favicon.ico 请求处理
|
http.HandleFunc(pattern, func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
http.ServeFile(w, r, filename)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// 主程序入口.
|
// 主程序入口.
|
||||||
|
@ -160,17 +162,17 @@ func main() {
|
||||||
|
|
||||||
defer glog.Flush()
|
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
|
// IDE
|
||||||
http.HandleFunc("/login", handlerWrapper(loginHandler))
|
http.HandleFunc("/login", handlerWrapper(loginHandler))
|
||||||
http.HandleFunc("/", handlerWrapper(indexHandler))
|
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/ws", handlerWrapper(session.WSHandler))
|
||||||
http.HandleFunc("/session/save", handlerWrapper(session.SaveContent))
|
http.HandleFunc("/session/save", handlerWrapper(session.SaveContent))
|
||||||
|
|
|
@ -3,8 +3,10 @@
|
||||||
width: 980px;
|
width: 980px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.header h1 {
|
.header .logo {
|
||||||
margin: 0;
|
float: left;
|
||||||
|
height: 32px;
|
||||||
|
margin-top: 3px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.header {
|
.header {
|
||||||
|
|
|
@ -280,6 +280,31 @@
|
||||||
width: 50px;
|
width: 50px;
|
||||||
padding: 0 5px;
|
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 */
|
/* end bottom-window-group */
|
||||||
|
|
||||||
/* start footer */
|
/* start footer */
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 36 KiB |
Binary file not shown.
After Width: | Height: | Size: 15 KiB |
|
@ -259,38 +259,69 @@ var editors = {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var usagesHTML = '<ul>';
|
editors.appendSearch(data.founds, 'usages', '');
|
||||||
|
|
||||||
for (var i = 0, ii = data.usages.length; i < ii; i++) {
|
|
||||||
usagesHTML += '<li>' + data.usages[i].path
|
|
||||||
+ '</li>';
|
|
||||||
}
|
|
||||||
usagesHTML += '</ul>';
|
|
||||||
|
|
||||||
editors.appendSearch(usagesHTML);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
appendSearch: function (html) {
|
appendSearch: function (data, type, key) {
|
||||||
var $usages = $('.bottom-window-group .search');
|
var searcHTML = '<ul>';
|
||||||
if ($usages.find("ul").length === 0) {
|
|
||||||
wide.usagesTab = new Tabs({
|
for (var i = 0, ii = data.length; i < ii; i++) {
|
||||||
|
var contents = data[i].contents[0],
|
||||||
|
index = contents.indexOf(key);
|
||||||
|
contents = contents.substring(0, index)
|
||||||
|
+ '<b>' + key + '</b>'
|
||||||
|
+ contents.substring(index + key.length);
|
||||||
|
|
||||||
|
searcHTML += '<li title="' + data[i].path + '">'
|
||||||
|
+ contents + " <span class='path'>" + data[i].path
|
||||||
|
+ '<i class="position" data-line="'
|
||||||
|
+ data[i].line + '" data-ch="' + data[i].ch + '"> (' + data[i].line + ':'
|
||||||
|
+ data[i].ch + ')</i></span></li>';
|
||||||
|
}
|
||||||
|
searcHTML += '</ul>';
|
||||||
|
|
||||||
|
var $search = $('.bottom-window-group .search'),
|
||||||
|
title = config.label.usages;
|
||||||
|
if (type === "founds") {
|
||||||
|
title = config.label.search_text;
|
||||||
|
}
|
||||||
|
if ($search.find("ul").length === 0) {
|
||||||
|
wide.searchTab = new Tabs({
|
||||||
id: ".bottom-window-group .search",
|
id: ".bottom-window-group .search",
|
||||||
removeAfter: function (id, prevId) {
|
removeAfter: function (id, prevId) {
|
||||||
if ($usages.find("ul").length === 1) {
|
if ($search.find("ul").length === 1) {
|
||||||
$usages.find(".tabs").hide();
|
$search.find(".tabs").hide();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$usages.find(".tabs-panel > div").append(html);
|
$search.on("click", "li", function () {
|
||||||
} else if ($usages.find("ul").length === 1) {
|
$search.find("li").removeClass("selected");
|
||||||
$usages.find(".tabs").show();
|
$(this).addClass("selected");
|
||||||
wide.usagesTab.add({
|
});
|
||||||
id: "b",
|
|
||||||
"title": 'Usages of ',
|
$search.on("dblclick", "li", function () {
|
||||||
"content": html + 1
|
var $it = $(this),
|
||||||
|
tId = tree.getTIdByPath($it.attr("title"));
|
||||||
|
tree.openFile(tree.fileTree.getNodeByTId(tId));
|
||||||
|
tree.fileTree.selectNode(wide.curNode);
|
||||||
|
|
||||||
|
var cursor = CodeMirror.Pos($it.find(".position").data("line") - 1, $it.find(".position").data("ch") - 1);
|
||||||
|
wide.curEditor.setCursor(cursor);
|
||||||
|
wide.curEditor.focus();
|
||||||
|
});
|
||||||
|
|
||||||
|
$search.find(".tabs-panel > div").append(searcHTML);
|
||||||
|
|
||||||
|
$search.find(".tabs .first").text(title);
|
||||||
|
} else {
|
||||||
|
$search.find(".tabs").show();
|
||||||
|
wide.searchTab.add({
|
||||||
|
"id": "search" + (new Date()).getTime(),
|
||||||
|
"title": title,
|
||||||
|
"content": searcHTML
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -213,8 +213,8 @@ var wide = {
|
||||||
$("#dialogSearchForm").dialog({
|
$("#dialogSearchForm").dialog({
|
||||||
"height": 52,
|
"height": 52,
|
||||||
"width": 260,
|
"width": 260,
|
||||||
"title": config.label.create_dir,
|
"title": config.label.search,
|
||||||
"okText": config.label.create,
|
"okText": config.label.search,
|
||||||
"cancelText": config.label.cancel,
|
"cancelText": config.label.cancel,
|
||||||
"afterOpen": function () {
|
"afterOpen": function () {
|
||||||
$("#dialogSearchForm > input:eq(0)").val('').focus();
|
$("#dialogSearchForm > input:eq(0)").val('').focus();
|
||||||
|
@ -235,15 +235,8 @@ var wide = {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var searcHTML = '<ul>';
|
$("#dialogSearchForm").dialog("close");
|
||||||
|
editors.appendSearch(data.founds, 'founds', request.text);
|
||||||
for (var i = 0, ii = data.founds.length; i < ii; i++) {
|
|
||||||
searcHTML += '<li>' + data.founds[i].path
|
|
||||||
+ '</li>';
|
|
||||||
}
|
|
||||||
searcHTML += '</ul>';
|
|
||||||
|
|
||||||
editors.appendSearch(searcHTML);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,6 +15,8 @@
|
||||||
<link rel="stylesheet" href="{{.conf.StaticServer}}/static/css/base.css?{{.conf.StaticResourceVersion}}">
|
<link rel="stylesheet" href="{{.conf.StaticServer}}/static/css/base.css?{{.conf.StaticResourceVersion}}">
|
||||||
<link rel="stylesheet" href="{{.conf.StaticServer}}/static/css/wide.css?{{.conf.StaticResourceVersion}}">
|
<link rel="stylesheet" href="{{.conf.StaticServer}}/static/css/wide.css?{{.conf.StaticResourceVersion}}">
|
||||||
<link rel="stylesheet" href="{{.conf.StaticServer}}/static/css/side.css?{{.conf.StaticResourceVersion}}">
|
<link rel="stylesheet" href="{{.conf.StaticServer}}/static/css/side.css?{{.conf.StaticResourceVersion}}">
|
||||||
|
|
||||||
|
<link rel="icon" type="image/x-icon" href="/favicon.ico" />
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<!-- 主菜单 -->
|
<!-- 主菜单 -->
|
||||||
|
@ -155,12 +157,12 @@
|
||||||
<div class="fn-none" data-index="search">
|
<div class="fn-none" data-index="search">
|
||||||
<div tabindex="-1" class="search">
|
<div tabindex="-1" class="search">
|
||||||
<div class="tabs fn-none">
|
<div class="tabs fn-none">
|
||||||
<div class="current" data-index="a">
|
<div class="current" data-index="first">
|
||||||
<span title="a">a</span><span class="ico-close font-ico"></span>
|
<span class="first"></span><span class="ico-close font-ico"></span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="tabs-panel">
|
<div class="tabs-panel">
|
||||||
<div data-index="a"></div>
|
<div data-index="first"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -216,7 +218,10 @@
|
||||||
"tip": "{{.i18n.tip}}",
|
"tip": "{{.i18n.tip}}",
|
||||||
"confirm": "{{.i18n.confirm}}",
|
"confirm": "{{.i18n.confirm}}",
|
||||||
"build_n_run": "{{.i18n.build_n_run}}",
|
"build_n_run": "{{.i18n.build_n_run}}",
|
||||||
"stop": "{{.i18n.stop}}"
|
"stop": "{{.i18n.stop}}",
|
||||||
|
"usages": "{{.i18n.usages}}",
|
||||||
|
"search_text": "{{.i18n.search_text}}",
|
||||||
|
"search": "{{.i18n.search}}"
|
||||||
},
|
},
|
||||||
"channel": {
|
"channel": {
|
||||||
"editor": '{{.conf.EditorChannel}}',
|
"editor": '{{.conf.EditorChannel}}',
|
||||||
|
|
|
@ -5,11 +5,14 @@
|
||||||
<title>{{.i18n.wide}} - {{.i18n.login}}</title>
|
<title>{{.i18n.wide}} - {{.i18n.login}}</title>
|
||||||
<link rel="stylesheet" href="{{.conf.StaticServer}}/static/css/base.css?{{.conf.StaticResourceVersion}}">
|
<link rel="stylesheet" href="{{.conf.StaticServer}}/static/css/base.css?{{.conf.StaticResourceVersion}}">
|
||||||
<link rel="stylesheet" href="{{.conf.StaticServer}}/static/css/login.css?{{.conf.StaticResourceVersion}}">
|
<link rel="stylesheet" href="{{.conf.StaticServer}}/static/css/login.css?{{.conf.StaticResourceVersion}}">
|
||||||
|
<link rel="icon" type="image/x-icon" href="/favicon.ico" />
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div class="header">
|
<div class="header">
|
||||||
<div class="wrapper fn-clear">
|
<div class="wrapper fn-clear">
|
||||||
<h1 class="fn-left"><a href="/login">Wide</a></h1>
|
<a href="/login">
|
||||||
|
<img src="{{.conf.StaticServer}}/static/images/wide-logo.png"
|
||||||
|
class="logo"/></a>
|
||||||
<ul class="fn-right">
|
<ul class="fn-right">
|
||||||
<li><a href="https://github.com/b3log/wide" target="_blank">GitHub</a></li>
|
<li><a href="https://github.com/b3log/wide" target="_blank">GitHub</a></li>
|
||||||
<li><a href="https://www.gitbook.io/book/88250/wide-user-guide" target="_blank">{{.i18n.help}}</a></li>
|
<li><a href="https://www.gitbook.io/book/88250/wide-user-guide" target="_blank">{{.i18n.help}}</a></li>
|
||||||
|
|
|
@ -4,6 +4,8 @@
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<title>{{.i18n.wide}}</title>
|
<title>{{.i18n.wide}}</title>
|
||||||
<link rel="stylesheet" href="{{.conf.StaticServer}}/static/css/shell.css?{{.conf.StaticResourceVersion}}">
|
<link rel="stylesheet" href="{{.conf.StaticServer}}/static/css/shell.css?{{.conf.StaticResourceVersion}}">
|
||||||
|
|
||||||
|
<link rel="icon" type="image/x-icon" href="/favicon.ico" />
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<input id="shellInput" placeholder="Command..."/>
|
<input id="shellInput" placeholder="Command..."/>
|
||||||
|
@ -14,12 +16,11 @@
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
var config = {
|
var config = {
|
||||||
channel: {
|
channel: {
|
||||||
shell: '{{.conf.ShellChannel}}'
|
shell: '{{.conf.ShellChannel}}'
|
||||||
},
|
},
|
||||||
wideSessionId: {{.session.Id}}
|
wideSessionId: {{.session.Id}}
|
||||||
};
|
};</script>
|
||||||
</script>
|
|
||||||
<script type="text/javascript" src="{{.conf.StaticServer}}/static/js/lib/jquery-2.1.1.min.js"></script>
|
<script type="text/javascript" src="{{.conf.StaticServer}}/static/js/lib/jquery-2.1.1.min.js"></script>
|
||||||
<script type="text/javascript" src="{{.conf.StaticServer}}/static/js/lib/reconnecting-websocket.js"></script>
|
<script type="text/javascript" src="{{.conf.StaticServer}}/static/js/lib/reconnecting-websocket.js"></script>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue