Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
946d872a
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,发现更多精彩内容 >>
提交
946d872a
编写于
12月 12, 2017
作者:
J
Joao Moreno
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
input box length warnings
introduces scm.inputCounter
上级
7b4bb1ed
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
58 addition
and
31 deletion
+58
-31
extensions/git/src/repository.ts
extensions/git/src/repository.ts
+1
-1
src/vs/vscode.d.ts
src/vs/vscode.d.ts
+2
-2
src/vs/workbench/api/electron-browser/mainThreadSCM.ts
src/vs/workbench/api/electron-browser/mainThreadSCM.ts
+2
-2
src/vs/workbench/api/node/extHost.protocol.ts
src/vs/workbench/api/node/extHost.protocol.ts
+1
-1
src/vs/workbench/api/node/extHostSCM.ts
src/vs/workbench/api/node/extHostSCM.ts
+6
-6
src/vs/workbench/parts/scm/electron-browser/scm.contribution.ts
.../workbench/parts/scm/electron-browser/scm.contribution.ts
+6
-0
src/vs/workbench/parts/scm/electron-browser/scmViewlet.ts
src/vs/workbench/parts/scm/electron-browser/scmViewlet.ts
+38
-9
src/vs/workbench/services/scm/common/scm.ts
src/vs/workbench/services/scm/common/scm.ts
+1
-1
src/vs/workbench/services/scm/common/scmService.ts
src/vs/workbench/services/scm/common/scmService.ts
+1
-9
未找到文件。
extensions/git/src/repository.ts
浏览文件 @
946d872a
...
...
@@ -519,7 +519,7 @@ export class Repository implements Disposable {
this
.
_sourceControl
.
inputBox
.
placeholder
=
localize
(
'
commitMessage
'
,
"
Message (press {0} to commit)
"
);
this
.
_sourceControl
.
acceptInputCommand
=
{
command
:
'
git.commitWithInput
'
,
title
:
localize
(
'
commit
'
,
"
Commit
"
),
arguments
:
[
this
.
_sourceControl
]
};
this
.
_sourceControl
.
quickDiffProvider
=
this
;
this
.
_sourceControl
.
inputBox
.
w
arningLength
=
72
;
this
.
_sourceControl
.
inputBox
.
lineW
arningLength
=
72
;
this
.
disposables
.
push
(
this
.
_sourceControl
);
this
.
_mergeGroup
=
this
.
_sourceControl
.
createResourceGroup
(
'
merge
'
,
localize
(
'
merge changes
'
,
"
Merge Changes
"
));
...
...
src/vs/vscode.d.ts
浏览文件 @
946d872a
...
...
@@ -5784,9 +5784,9 @@ declare module 'vscode' {
placeholder
:
string
;
/**
* The warning threshold for
commit messages
.
* The warning threshold for
lines in the input box
.
*/
w
arningLength
:
number
|
undefined
;
lineW
arningLength
:
number
|
undefined
;
}
interface
QuickDiffProvider
{
...
...
src/vs/workbench/api/electron-browser/mainThreadSCM.ts
浏览文件 @
946d872a
...
...
@@ -392,13 +392,13 @@ export class MainThreadSCM implements MainThreadSCMShape {
repository
.
input
.
placeholder
=
placeholder
;
}
$set
WarningLength
(
sourceControlHandle
:
number
,
w
arningLength
:
number
):
void
{
$set
LineWarningLength
(
sourceControlHandle
:
number
,
lineW
arningLength
:
number
):
void
{
const
repository
=
this
.
_repositories
[
sourceControlHandle
];
if
(
!
repository
)
{
return
;
}
repository
.
input
.
warningLength
=
w
arningLength
;
repository
.
input
.
lineWarningLength
=
lineW
arningLength
;
}
}
src/vs/workbench/api/node/extHost.protocol.ts
浏览文件 @
946d872a
...
...
@@ -410,7 +410,7 @@ export interface MainThreadSCMShape extends IDisposable {
$setInputBoxValue
(
sourceControlHandle
:
number
,
value
:
string
):
void
;
$setInputBoxPlaceholder
(
sourceControlHandle
:
number
,
placeholder
:
string
):
void
;
$set
WarningLength
(
sourceControlHandle
:
number
,
w
arningLength
:
number
):
void
;
$set
LineWarningLength
(
sourceControlHandle
:
number
,
lineW
arningLength
:
number
):
void
;
}
export
type
DebugSessionUUID
=
string
;
...
...
src/vs/workbench/api/node/extHostSCM.ts
浏览文件 @
946d872a
...
...
@@ -140,15 +140,15 @@ export class ExtHostSCMInputBox implements vscode.SourceControlInputBox {
this
.
_placeholder
=
placeholder
;
}
private
_
w
arningLength
:
number
|
undefined
;
private
_
lineW
arningLength
:
number
|
undefined
;
get
w
arningLength
():
number
|
undefined
{
return
this
.
_
w
arningLength
;
get
lineW
arningLength
():
number
|
undefined
{
return
this
.
_
lineW
arningLength
;
}
set
warningLength
(
w
arningLength
:
number
)
{
this
.
_proxy
.
$set
WarningLength
(
this
.
_sourceControlHandle
,
w
arningLength
);
this
.
_
warningLength
=
w
arningLength
;
set
lineWarningLength
(
lineW
arningLength
:
number
)
{
this
.
_proxy
.
$set
LineWarningLength
(
this
.
_sourceControlHandle
,
lineW
arningLength
);
this
.
_
lineWarningLength
=
lineW
arningLength
;
}
constructor
(
private
_proxy
:
MainThreadSCMShape
,
private
_sourceControlHandle
:
number
)
{
...
...
src/vs/workbench/parts/scm/electron-browser/scm.contribution.ts
浏览文件 @
946d872a
...
...
@@ -74,5 +74,11 @@ Registry.as<IConfigurationRegistry>(ConfigurationExtensions.Configuration).regis
default
:
'
all
'
,
description
:
localize
(
'
diffDecorations
'
,
"
Controls diff decorations in the editor.
"
)
},
'
scm.inputCounter
'
:
{
type
:
'
string
'
,
enum
:
[
'
always
'
,
'
warn
'
,
'
off
'
],
default
:
'
warn
'
,
description
:
localize
(
'
inputCounter
'
,
"
Controls when to display the input counter.
"
)
}
}
});
\ No newline at end of file
src/vs/workbench/parts/scm/electron-browser/scmViewlet.ts
浏览文件 @
946d872a
...
...
@@ -8,7 +8,7 @@
import
'
vs/css!./media/scmViewlet
'
;
import
{
localize
}
from
'
vs/nls
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
Event
,
{
Emitter
,
chain
,
mapEvent
}
from
'
vs/base/common/event
'
;
import
Event
,
{
Emitter
,
chain
,
mapEvent
,
anyEvent
}
from
'
vs/base/common/event
'
;
import
{
domEvent
,
stop
}
from
'
vs/base/browser/event
'
;
import
{
basename
}
from
'
vs/base/common/paths
'
;
import
{
onUnexpectedError
}
from
'
vs/base/common/errors
'
;
...
...
@@ -56,6 +56,7 @@ import { format } from 'vs/base/common/strings';
import
{
ISpliceable
,
ISequence
,
ISplice
}
from
'
vs/base/common/sequence
'
;
import
{
firstIndex
}
from
'
vs/base/common/arrays
'
;
import
{
WorkbenchList
,
IListService
}
from
'
vs/platform/list/browser/listService
'
;
import
{
IConfigurationService
}
from
'
vs/platform/configuration/common/configuration
'
;
// TODO@Joao
// Need to subclass MenuItemActionItem in order to respect
...
...
@@ -695,7 +696,8 @@ export class RepositoryPanel extends ViewletPanel {
@
IWorkbenchEditorService
protected
editorService
:
IWorkbenchEditorService
,
@
IEditorGroupService
protected
editorGroupService
:
IEditorGroupService
,
@
IContextKeyService
protected
contextKeyService
:
IContextKeyService
,
@
IInstantiationService
protected
instantiationService
:
IInstantiationService
@
IInstantiationService
protected
instantiationService
:
IInstantiationService
,
@
IConfigurationService
protected
configurationService
:
IConfigurationService
)
{
super
(
repository
.
provider
.
label
,
{},
keybindingService
,
contextMenuService
);
this
.
menus
=
instantiationService
.
createInstance
(
SCMMenus
,
repository
.
provider
);
...
...
@@ -754,23 +756,46 @@ export class RepositoryPanel extends ViewletPanel {
};
const
validation
=
(
text
:
string
):
IMessage
=>
{
const
warningLength
=
this
.
repository
.
input
.
warningLength
;
if
(
warningLength
===
undefined
)
{
const
setting
=
this
.
configurationService
.
getValue
<
'
always
'
|
'
warn
'
|
'
off
'
>
(
'
scm.inputCounter
'
);
if
(
setting
===
'
off
'
)
{
return
null
;
}
let
position
=
this
.
inputBox
.
inputElement
.
selectionStart
;
let
start
=
0
,
end
;
let
match
:
RegExpExecArray
;
const
regex
=
/
\r?\n
/g
;
while
((
match
=
regex
.
exec
(
text
))
&&
position
>
match
.
index
)
{
start
=
match
.
index
+
match
[
0
].
length
;
}
end
=
match
?
match
.
index
:
text
.
length
;
const
line
=
text
.
substring
(
start
,
end
);
const
lineWarningLength
=
this
.
repository
.
input
.
lineWarningLength
;
if
(
lineWarningLength
===
undefined
)
{
return
{
content
:
localize
(
'
commitMessageInfo
'
,
"
{0} characters
"
,
text
.
length
),
content
:
localize
(
'
commitMessageInfo
'
,
"
{0} characters
in current line
"
,
text
.
length
),
type
:
MessageType
.
INFO
};
}
const
charactersLeft
=
warningLength
-
text
.
length
;
if
(
charactersLeft
>
0
)
{
if
(
line
.
length
<=
lineWarningLength
)
{
if
(
setting
!==
'
always
'
)
{
return
null
;
}
return
{
content
:
localize
(
'
commitMessageCountdown
'
,
"
{0} characters left
"
,
text
.
length
),
content
:
localize
(
'
commitMessageCountdown
'
,
"
{0} characters left
in current line
"
,
lineWarningLength
-
line
.
length
),
type
:
MessageType
.
INFO
};
}
else
{
return
{
content
:
localize
(
'
commitMessageWarning
'
,
"
{0} characters over
"
,
text
.
l
ength
),
content
:
localize
(
'
commitMessageWarning
'
,
"
{0} characters over
{1} in current line
"
,
line
.
length
-
lineWarningLength
,
lineWarningL
ength
),
type
:
MessageType
.
WARNING
};
}
...
...
@@ -783,6 +808,10 @@ export class RepositoryPanel extends ViewletPanel {
this
.
disposables
.
push
(
attachInputBoxStyler
(
this
.
inputBox
,
this
.
themeService
));
this
.
disposables
.
push
(
this
.
inputBox
);
const
onKeyUp
=
domEvent
(
this
.
inputBox
.
inputElement
,
'
keyup
'
);
const
onMouseUp
=
domEvent
(
this
.
inputBox
.
inputElement
,
'
mouseup
'
);
anyEvent
<
any
>
(
onKeyUp
,
onMouseUp
)(()
=>
this
.
inputBox
.
validate
(),
null
,
this
.
disposables
);
this
.
inputBox
.
value
=
this
.
repository
.
input
.
value
;
this
.
inputBox
.
onDidChange
(
value
=>
this
.
repository
.
input
.
value
=
value
,
null
,
this
.
disposables
);
this
.
repository
.
input
.
onDidChange
(
value
=>
this
.
inputBox
.
value
=
value
,
null
,
this
.
disposables
);
...
...
src/vs/workbench/services/scm/common/scm.ts
浏览文件 @
946d872a
...
...
@@ -75,7 +75,7 @@ export interface ISCMInput {
placeholder
:
string
;
readonly
onDidChangePlaceholder
:
Event
<
string
>
;
w
arningLength
:
number
|
undefined
;
lineW
arningLength
:
number
|
undefined
;
}
export
interface
ISCMRepository
extends
IDisposable
{
...
...
src/vs/workbench/services/scm/common/scmService.ts
浏览文件 @
946d872a
...
...
@@ -40,15 +40,7 @@ class SCMInput implements ISCMInput {
private
_onDidChangePlaceholder
=
new
Emitter
<
string
>
();
get
onDidChangePlaceholder
():
Event
<
string
>
{
return
this
.
_onDidChangePlaceholder
.
event
;
}
private
_warningLength
:
number
|
undefined
;
get
warningLength
():
number
|
undefined
{
return
this
.
_warningLength
;
}
set
warningLength
(
warningLength
:
number
)
{
this
.
_warningLength
=
warningLength
;
}
public
lineWarningLength
:
number
|
undefined
=
undefined
;
}
class
SCMRepository
implements
ISCMRepository
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录