Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
039f15a0
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,体验更适合开发者的 AI 搜索 >>
提交
039f15a0
编写于
12月 10, 2020
作者:
B
Benjamin Pasero
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
💄
上级
c7fa31fc
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
44 addition
and
44 deletion
+44
-44
src/vs/base/browser/dom.ts
src/vs/base/browser/dom.ts
+6
-0
src/vs/editor/browser/services/openerService.ts
src/vs/editor/browser/services/openerService.ts
+3
-4
src/vs/workbench/browser/web.main.ts
src/vs/workbench/browser/web.main.ts
+5
-12
src/vs/workbench/electron-browser/desktop.main.ts
src/vs/workbench/electron-browser/desktop.main.ts
+5
-2
src/vs/workbench/electron-sandbox/window.ts
src/vs/workbench/electron-sandbox/window.ts
+25
-26
未找到文件。
src/vs/base/browser/dom.ts
浏览文件 @
039f15a0
...
...
@@ -1602,3 +1602,9 @@ export class ModifierKeyEmitter extends Emitter<IModifierKeyStatus> {
this
.
_subscriptions
.
dispose
();
}
}
export
function
getCookieValue
(
name
:
string
):
string
|
undefined
{
const
match
=
document
.
cookie
.
match
(
'
(^|[^;]+)
\\
s*
'
+
name
+
'
\\
s*=
\\
s*([^;]+)
'
);
// See https://stackoverflow.com/a/25490531
return
match
?
match
.
pop
()
:
undefined
;
}
src/vs/editor/browser/services/openerService.ts
浏览文件 @
039f15a0
...
...
@@ -16,7 +16,6 @@ import { IOpener, IOpenerService, IValidator, IExternalUriResolver, OpenOptions,
import
{
EditorOpenContext
}
from
'
vs/platform/editor/common/editor
'
;
import
{
ResourceMap
}
from
'
vs/base/common/map
'
;
class
CommandOpener
implements
IOpener
{
constructor
(@
ICommandService
private
readonly
_commandService
:
ICommandService
)
{
}
...
...
@@ -108,7 +107,7 @@ export class OpenerService implements IOpenerService {
)
{
// Default external opener is going through window.open()
this
.
_externalOpener
=
{
openExternal
:
href
=>
{
openExternal
:
async
href
=>
{
// ensure to open HTTP/HTTPS links into new windows
// to not trigger a navigation. Any other link is
// safe to be set as HREF to prevent a blank window
...
...
@@ -118,11 +117,11 @@ export class OpenerService implements IOpenerService {
}
else
{
window
.
location
.
href
=
href
;
}
return
Promise
.
resolve
(
true
)
;
return
true
;
}
};
// Default opener: maito, http(s), command, and catch-all-editors
// Default opener:
any external,
maito, http(s), command, and catch-all-editors
this
.
_openers
.
push
({
open
:
async
(
target
:
URI
|
string
,
options
?:
OpenOptions
)
=>
{
if
(
options
?.
openExternal
||
matchesScheme
(
target
,
Schemas
.
mailto
)
||
matchesScheme
(
target
,
Schemas
.
http
)
||
matchesScheme
(
target
,
Schemas
.
https
))
{
...
...
src/vs/workbench/browser/web.main.ts
浏览文件 @
039f15a0
...
...
@@ -5,7 +5,7 @@
import
{
mark
}
from
'
vs/base/common/performance
'
;
import
{
hash
}
from
'
vs/base/common/hash
'
;
import
{
domContentLoaded
,
addDisposableListener
,
EventType
,
EventHelper
,
detectFullscreen
,
addDisposableThrottledListener
}
from
'
vs/base/browser/dom
'
;
import
{
domContentLoaded
,
addDisposableListener
,
EventType
,
EventHelper
,
detectFullscreen
,
addDisposableThrottledListener
,
getCookieValue
}
from
'
vs/base/browser/dom
'
;
import
{
ServiceCollection
}
from
'
vs/platform/instantiation/common/serviceCollection
'
;
import
{
ILogService
,
ConsoleLogService
,
MultiplexLogService
,
getLogLevel
}
from
'
vs/platform/log/common/log
'
;
import
{
ConsoleLogInAutomationService
}
from
'
vs/platform/log/browser/log
'
;
...
...
@@ -142,9 +142,7 @@ class BrowserMain extends Disposable {
event
.
veto
(
true
);
// prevent data loss from pending storage update
}
}));
this
.
_register
(
workbench
.
onWillShutdown
(()
=>
{
storageService
.
close
();
}));
this
.
_register
(
workbench
.
onWillShutdown
(()
=>
storageService
.
close
()));
this
.
_register
(
workbench
.
onShutdown
(()
=>
this
.
dispose
()));
// Fullscreen (Browser)
...
...
@@ -181,9 +179,8 @@ class BrowserMain extends Disposable {
const
logService
=
new
BufferLogService
(
getLogLevel
(
environmentService
));
serviceCollection
.
set
(
ILogService
,
logService
);
const
connectionToken
=
environmentService
.
options
.
connectionToken
||
this
.
getCookieValue
(
'
vscode-tkn
'
);
// Remote
const
connectionToken
=
environmentService
.
options
.
connectionToken
||
getCookieValue
(
'
vscode-tkn
'
);
const
remoteAuthorityResolverService
=
new
RemoteAuthorityResolverService
(
connectionToken
,
this
.
configuration
.
resourceUriProvider
);
serviceCollection
.
set
(
IRemoteAuthorityResolverService
,
remoteAuthorityResolverService
);
...
...
@@ -240,12 +237,14 @@ class BrowserMain extends Disposable {
if
(
await
userDataInitializationService
.
requiresInitialization
())
{
mark
(
'
willInitRequiredUserData
'
);
// Initialize required resources - settings & global state
await
userDataInitializationService
.
initializeRequiredResources
();
// Important: Reload only local user configuration after initializing
// Reloading complete configuraiton blocks workbench until remote configuration is loaded.
await
configurationService
.
reloadLocalUserConfiguration
();
mark
(
'
didInitRequiredUserData
'
);
}
...
...
@@ -370,12 +369,6 @@ class BrowserMain extends Disposable {
return
{
id
:
'
empty-window
'
};
}
private
getCookieValue
(
name
:
string
):
string
|
undefined
{
const
match
=
document
.
cookie
.
match
(
'
(^|[^;]+)
\\
s*
'
+
name
+
'
\\
s*=
\\
s*([^;]+)
'
);
// See https://stackoverflow.com/a/25490531
return
match
?
match
.
pop
()
:
undefined
;
}
}
export
function
main
(
domElement
:
HTMLElement
,
options
:
IWorkbenchConstructionOptions
):
Promise
<
IWorkbench
>
{
...
...
src/vs/workbench/electron-browser/desktop.main.ts
浏览文件 @
039f15a0
...
...
@@ -344,8 +344,11 @@ class DesktopMain extends Disposable {
const
folder
=
folderUri
.
scheme
===
Schemas
.
file
?
URI
.
file
(
sanitizeFilePath
(
folderUri
.
fsPath
,
process
.
env
[
'
VSCODE_CWD
'
]
||
process
.
cwd
()))
// For local: ensure path is absolute
:
folderUri
;
const
id
=
await
this
.
createHash
(
folderUri
);
return
{
id
,
folder
};
return
{
id
:
await
this
.
createHash
(
folderUri
),
folder
};
}
catch
(
error
)
{
onUnexpectedError
(
error
);
}
...
...
src/vs/workbench/electron-sandbox/window.ts
浏览文件 @
039f15a0
...
...
@@ -3,11 +3,11 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import
*
as
nls
from
'
vs/nls
'
;
import
{
localize
}
from
'
vs/nls
'
;
import
{
URI
}
from
'
vs/base/common/uri
'
;
import
*
as
errors
from
'
vs/base/common/errors
'
;
import
{
onUnexpectedError
}
from
'
vs/base/common/errors
'
;
import
{
equals
}
from
'
vs/base/common/objects
'
;
import
*
as
DOM
from
'
vs/base/browser/dom
'
;
import
{
EventType
,
EventHelper
,
addDisposableListener
}
from
'
vs/base/browser/dom
'
;
import
{
IAction
,
Separator
}
from
'
vs/base/common/actions
'
;
import
{
IFileService
}
from
'
vs/platform/files/common/files
'
;
import
{
EditorResourceAccessor
,
IUntitledTextResourceEditorInput
,
SideBySideEditor
,
pathsToEditors
}
from
'
vs/workbench/common/editor
'
;
...
...
@@ -126,9 +126,9 @@ export class NativeWindow extends Disposable {
this
.
_register
(
this
.
editorService
.
onDidActiveEditorChange
(()
=>
this
.
updateTouchbarMenu
()));
// prevent opening a real URL inside the shell
[
DOM
.
EventType
.
DRAG_OVER
,
DOM
.
EventType
.
DROP
].
forEach
(
event
=>
{
[
EventType
.
DRAG_OVER
,
EventType
.
DROP
].
forEach
(
event
=>
{
window
.
document
.
body
.
addEventListener
(
event
,
(
e
:
DragEvent
)
=>
{
DOM
.
EventHelper
.
stop
(
e
);
EventHelper
.
stop
(
e
);
});
});
...
...
@@ -173,7 +173,7 @@ export class NativeWindow extends Disposable {
// Error reporting from main
ipcRenderer
.
on
(
'
vscode:reportError
'
,
(
event
:
unknown
,
error
:
string
)
=>
{
if
(
error
)
{
errors
.
onUnexpectedError
(
JSON
.
parse
(
error
));
onUnexpectedError
(
JSON
.
parse
(
error
));
}
});
...
...
@@ -188,13 +188,13 @@ export class NativeWindow extends Disposable {
// Shell Environment Issue Notifications
const
choices
:
IPromptChoice
[]
=
[{
label
:
nls
.
localize
(
'
learnMode
'
,
"
Learn More
"
),
label
:
localize
(
'
learnMode
'
,
"
Learn More
"
),
run
:
()
=>
this
.
openerService
.
open
(
'
https://go.microsoft.com/fwlink/?linkid=2149667
'
)
}];
ipcRenderer
.
on
(
'
vscode:showShellEnvSlowWarning
'
,
()
=>
this
.
notificationService
.
prompt
(
Severity
.
Warning
,
nls
.
localize
(
'
shellEnvSlowWarning
'
,
"
Resolving your shell environment is taking very long. Please review your shell configuration.
"
),
localize
(
'
shellEnvSlowWarning
'
,
"
Resolving your shell environment is taking very long. Please review your shell configuration.
"
),
choices
,
{
sticky
:
true
,
...
...
@@ -204,7 +204,7 @@ export class NativeWindow extends Disposable {
ipcRenderer
.
on
(
'
vscode:showShellEnvTimeoutError
'
,
()
=>
this
.
notificationService
.
prompt
(
Severity
.
Error
,
nls
.
localize
(
'
shellEnvTimeoutError
'
,
"
Unable to resolve your shell environment in a reasonable time. Please review your shell configuration.
"
),
localize
(
'
shellEnvTimeoutError
'
,
"
Unable to resolve your shell environment in a reasonable time. Please review your shell configuration.
"
),
choices
));
...
...
@@ -222,20 +222,20 @@ export class NativeWindow extends Disposable {
// Proxy Login Dialog
ipcRenderer
.
on
(
'
vscode:openProxyAuthenticationDialog
'
,
async
(
event
:
unknown
,
payload
:
{
authInfo
:
AuthInfo
,
username
?:
string
,
password
?:
string
,
replyChannel
:
string
})
=>
{
const
rememberCredentials
=
this
.
storageService
.
getBoolean
(
NativeWindow
.
REMEMBER_PROXY_CREDENTIALS_KEY
,
StorageScope
.
GLOBAL
);
const
result
=
await
this
.
dialogService
.
input
(
Severity
.
Warning
,
nls
.
localize
(
'
proxyAuthRequired
'
,
"
Proxy Authentication Required
"
),
const
result
=
await
this
.
dialogService
.
input
(
Severity
.
Warning
,
localize
(
'
proxyAuthRequired
'
,
"
Proxy Authentication Required
"
),
[
nls
.
localize
({
key
:
'
loginButton
'
,
comment
:
[
'
&& denotes a mnemonic
'
]
},
"
&&Log In
"
),
nls
.
localize
({
key
:
'
cancelButton
'
,
comment
:
[
'
&& denotes a mnemonic
'
]
},
"
&&Cancel
"
)
localize
({
key
:
'
loginButton
'
,
comment
:
[
'
&& denotes a mnemonic
'
]
},
"
&&Log In
"
),
localize
({
key
:
'
cancelButton
'
,
comment
:
[
'
&& denotes a mnemonic
'
]
},
"
&&Cancel
"
)
],
[
{
placeholder
:
nls
.
localize
(
'
username
'
,
"
Username
"
),
value
:
payload
.
username
},
{
placeholder
:
nls
.
localize
(
'
password
'
,
"
Password
"
),
type
:
'
password
'
,
value
:
payload
.
password
}
{
placeholder
:
localize
(
'
username
'
,
"
Username
"
),
value
:
payload
.
username
},
{
placeholder
:
localize
(
'
password
'
,
"
Password
"
),
type
:
'
password
'
,
value
:
payload
.
password
}
],
{
cancelId
:
1
,
detail
:
nls
.
localize
(
'
proxyDetail
'
,
"
The proxy {0} requires a username and password.
"
,
`
${
payload
.
authInfo
.
host
}
:
${
payload
.
authInfo
.
port
}
`
),
detail
:
localize
(
'
proxyDetail
'
,
"
The proxy {0} requires a username and password.
"
,
`
${
payload
.
authInfo
.
host
}
:
${
payload
.
authInfo
.
port
}
`
),
checkbox
:
{
label
:
nls
.
localize
(
'
rememberCredentials
'
,
"
Remember my credentials
"
),
label
:
localize
(
'
rememberCredentials
'
,
"
Remember my credentials
"
),
checked
:
rememberCredentials
}
});
...
...
@@ -303,8 +303,8 @@ export class NativeWindow extends Disposable {
if
(
isMacintosh
&&
getTitleBarStyle
(
this
.
configurationService
)
===
'
custom
'
)
{
const
titlePart
=
assertIsDefined
(
this
.
layoutService
.
getContainer
(
Parts
.
TITLEBAR_PART
));
this
.
_register
(
DOM
.
addDisposableListener
(
titlePart
,
DOM
.
EventType
.
DBLCLICK
,
e
=>
{
DOM
.
EventHelper
.
stop
(
e
);
this
.
_register
(
addDisposableListener
(
titlePart
,
EventType
.
DBLCLICK
,
e
=>
{
EventHelper
.
stop
(
e
);
this
.
nativeHostService
.
handleTitleDoubleClick
();
}));
...
...
@@ -331,9 +331,7 @@ export class NativeWindow extends Disposable {
this
.
onDidChangeMaximized
(
this
.
environmentService
.
configuration
.
maximized
??
false
);
// Detect panel position to determine minimum width
this
.
_register
(
this
.
layoutService
.
onPanelPositionChange
(
pos
=>
{
this
.
onDidPanelPositionChange
(
positionFromString
(
pos
));
}));
this
.
_register
(
this
.
layoutService
.
onPanelPositionChange
(
pos
=>
this
.
onDidPanelPositionChange
(
positionFromString
(
pos
))));
this
.
onDidPanelPositionChange
(
this
.
layoutService
.
getPanelPosition
());
}
...
...
@@ -350,18 +348,19 @@ export class NativeWindow extends Disposable {
}
private
getWindowMinimumWidth
(
panelPosition
:
Position
=
this
.
layoutService
.
getPanelPosition
()):
number
{
// if panel is on the side, then return the larger minwidth
const
panelOnSide
=
panelPosition
===
Position
.
LEFT
||
panelPosition
===
Position
.
RIGHT
;
if
(
panelOnSide
)
{
return
WindowMinimumSize
.
WIDTH_WITH_VERTICAL_PANEL
;
}
else
{
return
WindowMinimumSize
.
WIDTH
;
}
return
WindowMinimumSize
.
WIDTH
;
}
private
onDidPanelPositionChange
(
pos
:
Position
):
void
{
const
minWidth
=
this
.
getWindowMinimumWidth
(
pos
);
this
.
nativeHostService
.
setMinimumSize
(
minWidth
,
undefined
);
}
...
...
@@ -470,7 +469,7 @@ export class NativeWindow extends Disposable {
// Show warning message (unix only)
if
(
isAdmin
&&
!
isWindows
)
{
this
.
notificationService
.
warn
(
nls
.
localize
(
'
runningAsRoot
'
,
"
It is not recommended to run {0} as root user.
"
,
this
.
productService
.
nameShort
));
this
.
notificationService
.
warn
(
localize
(
'
runningAsRoot
'
,
"
It is not recommended to run {0} as root user.
"
,
this
.
productService
.
nameShort
));
}
});
...
...
@@ -704,7 +703,7 @@ class NativeMenubarControl extends MenubarControl {
if
(
isMacintosh
)
{
this
.
menus
[
'
Preferences
'
]
=
this
.
_register
(
this
.
menuService
.
createMenu
(
MenuId
.
MenubarPreferencesMenu
,
this
.
contextKeyService
));
this
.
topLevelTitles
[
'
Preferences
'
]
=
nls
.
localize
(
'
mPreferences
'
,
"
Preferences
"
);
this
.
topLevelTitles
[
'
Preferences
'
]
=
localize
(
'
mPreferences
'
,
"
Preferences
"
);
}
for
(
const
topLevelMenuName
of
Object
.
keys
(
this
.
topLevelTitles
))
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录