Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
08be8f25
V
vscode
项目概览
xxadev
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vscode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
08be8f25
编写于
2月 15, 2017
作者:
J
Johannes Rieken
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
show a message when no definition/implementation etc could be found
上级
d871d315
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
99 addition
and
9 deletion
+99
-9
src/vs/editor/contrib/goToDeclaration/browser/goToDeclaration.css
...ditor/contrib/goToDeclaration/browser/goToDeclaration.css
+21
-0
src/vs/editor/contrib/goToDeclaration/browser/goToDeclaration.ts
...editor/contrib/goToDeclaration/browser/goToDeclaration.ts
+78
-9
未找到文件。
src/vs/editor/contrib/goToDeclaration/browser/goToDeclaration.css
浏览文件 @
08be8f25
...
...
@@ -3,6 +3,27 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
.monaco-editor
.monaco-editor-overlaymessage
{
padding-bottom
:
8px
;
}
.monaco-editor
.monaco-editor-overlaymessage
.message
{
padding
:
1px
4px
;
background
:
#1382CE
;
color
:
white
;
}
.monaco-editor
.monaco-editor-overlaymessage
.anchor
{
width
:
0
!important
;
height
:
0
!important
;
border-color
:
transparent
;
border-style
:
solid
;
z-index
:
1000
;
border-width
:
8px
;
border-top-color
:
#1382CE
;
position
:
absolute
;
}
.monaco-editor
.preview-zone-widget.preview
.monaco-editor
,
.monaco-editor
.preview-zone-widget.preview
.monaco-editor-background
,
.monaco-editor
.preview-zone-widget.preview
.monaco-editor
.line-numbers
,
...
...
src/vs/editor/contrib/goToDeclaration/browser/goToDeclaration.ts
浏览文件 @
08be8f25
...
...
@@ -8,6 +8,7 @@
import
'
vs/css!./goToDeclaration
'
;
import
*
as
nls
from
'
vs/nls
'
;
import
{
Throttler
}
from
'
vs/base/common/async
'
;
import
{
any
,
filterEvent
}
from
'
vs/base/common/event
'
;
import
{
onUnexpectedError
}
from
'
vs/base/common/errors
'
;
import
{
MarkedString
}
from
'
vs/base/common/htmlContent
'
;
import
{
KeyCode
,
KeyMod
,
KeyChord
}
from
'
vs/base/common/keyCodes
'
;
...
...
@@ -24,7 +25,7 @@ import { Range } from 'vs/editor/common/core/range';
import
*
as
editorCommon
from
'
vs/editor/common/editorCommon
'
;
import
{
editorAction
,
IActionOptions
,
ServicesAccessor
,
EditorAction
}
from
'
vs/editor/common/editorCommonExtensions
'
;
import
{
Location
,
DefinitionProviderRegistry
}
from
'
vs/editor/common/modes
'
;
import
{
ICodeEditor
,
IEditorMouseEvent
,
IMouseTarget
}
from
'
vs/editor/browser/editorBrowser
'
;
import
{
ICodeEditor
,
IEditorMouseEvent
,
IMouseTarget
,
IContentWidget
,
IContentWidgetPosition
,
ContentWidgetPositionPreference
}
from
'
vs/editor/browser/editorBrowser
'
;
import
{
editorContribution
}
from
'
vs/editor/browser/editorBrowserExtensions
'
;
import
{
getDefinitionsAtPosition
,
getImplementationsAtPosition
,
getTypeDefinitionsAtPosition
}
from
'
vs/editor/contrib/goToDeclaration/common/goToDeclaration
'
;
import
{
ReferencesController
}
from
'
vs/editor/contrib/referenceSearch/browser/referencesController
'
;
...
...
@@ -34,16 +35,87 @@ import { PeekContext } from 'vs/editor/contrib/zoneWidget/browser/peekViewWidget
import
{
ContextKeyExpr
}
from
'
vs/platform/contextkey/common/contextkey
'
;
import
{
ITextModelResolverService
}
from
'
vs/editor/common/services/resolverService
'
;
import
*
as
corePosition
from
'
vs/editor/common/core/position
'
;
import
ModeContextKeys
=
editorCommon
.
ModeContextKeys
;
import
EditorContextKeys
=
editorCommon
.
EditorContextKeys
;
class
MessageOverlay
implements
IContentWidget
{
private
static
_last
:
IDisposable
;
static
show
(
editor
:
ICodeEditor
,
pos
:
editorCommon
.
IPosition
,
message
:
string
):
IDisposable
{
dispose
(
MessageOverlay
.
_last
);
const
widget
=
new
MessageOverlay
(
message
,
pos
.
lineNumber
,
editor
.
getOffsetForColumn
(
pos
.
lineNumber
,
pos
.
column
));
const
remove
=
()
=>
editor
.
removeContentWidget
(
widget
);
editor
.
addContentWidget
(
widget
);
const
unhook
=
any
<
any
>
(
filterEvent
(
editor
.
onMouseMove
,
e
=>
{
const
{
position
}
=
e
.
target
;
return
Math
.
abs
(
position
.
lineNumber
-
pos
.
lineNumber
)
>
1
||
Math
.
abs
(
position
.
column
-
pos
.
column
)
>
10
;
}),
editor
.
onDidChangeCursorPosition
,
editor
.
onDidBlurEditorText
,
editor
.
onDidDispose
,
editor
.
onDidChangeModel
)(
_
=>
{
unhook
.
dispose
();
remove
();
});
MessageOverlay
.
_last
=
unhook
;
return
unhook
;
}
readonly
allowEditorOverflow
=
true
;
readonly
suppressMouseDown
=
false
;
private
_position
:
editorCommon
.
IPosition
;
private
_domNode
:
HTMLDivElement
;
constructor
(
text
:
string
,
lineNumber
:
number
,
horizontalOffset
:
number
)
{
this
.
_position
=
{
lineNumber
,
column
:
1
};
this
.
_domNode
=
document
.
createElement
(
'
div
'
);
this
.
_domNode
.
style
.
paddingLeft
=
`
${
horizontalOffset
-
6
}
px`
;
this
.
_domNode
.
classList
.
add
(
'
monaco-editor-overlaymessage
'
);
const
message
=
document
.
createElement
(
'
div
'
);
message
.
classList
.
add
(
'
message
'
);
message
.
textContent
=
text
;
this
.
_domNode
.
appendChild
(
message
);
const
anchor
=
document
.
createElement
(
'
div
'
);
anchor
.
classList
.
add
(
'
anchor
'
);
this
.
_domNode
.
appendChild
(
anchor
);
}
getId
():
string
{
return
'
messageoverlay
'
;
}
getDomNode
():
HTMLElement
{
return
this
.
_domNode
;
}
getPosition
():
IContentWidgetPosition
{
return
{
position
:
this
.
_position
,
preference
:
[
ContentWidgetPositionPreference
.
ABOVE
]
};
}
}
export
class
DefinitionActionConfig
{
constructor
(
public
openToSide
=
false
,
public
openInPeek
=
false
,
public
filterCurrent
=
true
public
filterCurrent
=
true
,
public
noResultsMessage
=
nls
.
localize
(
'
generic.noResults
'
,
"
Could not find anything
"
)
)
{
//
}
...
...
@@ -67,10 +139,6 @@ export class DefinitionAction extends EditorAction {
return
this
.
getDeclarationsAtPosition
(
model
,
pos
).
then
(
references
=>
{
if
(
!
references
)
{
return
;
}
// * remove falsy references
// * remove reference at the current pos
// * collapse ranges to start pos
...
...
@@ -80,7 +148,7 @@ export class DefinitionAction extends EditorAction {
if
(
!
reference
||
!
reference
.
range
)
{
continue
;
}
let
{
uri
,
range
}
=
reference
;
let
{
uri
,
range
}
=
reference
;
if
(
!
this
.
_configuration
.
filterCurrent
||
uri
.
toString
()
!==
model
.
uri
.
toString
()
||
!
Range
.
containsPosition
(
range
,
pos
))
{
...
...
@@ -93,6 +161,7 @@ export class DefinitionAction extends EditorAction {
}
if
(
result
.
length
===
0
)
{
MessageOverlay
.
show
(
<
ICodeEditor
>
editor
,
pos
,
this
.
_configuration
.
noResultsMessage
);
return
;
}
...
...
@@ -125,7 +194,7 @@ export class DefinitionAction extends EditorAction {
}
private
_openReference
(
editorService
:
IEditorService
,
reference
:
Location
,
sideBySide
:
boolean
):
TPromise
<
editorCommon
.
ICommonCodeEditor
>
{
let
{
uri
,
range
}
=
reference
;
let
{
uri
,
range
}
=
reference
;
return
editorService
.
openEditor
({
resource
:
uri
,
options
:
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录