-
Notifications
You must be signed in to change notification settings - Fork 29.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use vscode-file://
instead of file://
#101837
Closed
Closed
Changes from 25 commits
Commits
Show all changes
55 commits
Select commit
Hold shift + click to select a range
86b7bbc
feat: add vscode-file scheme
deepak1556 09e273a
Merge remote-tracking branch 'origin/master' into robo/vscode-file
alexdima 505b841
Experimental tweaks to load from vscode-file:
alexdima 560df14
Merge remote-tracking branch 'origin/master' into robo/vscode-file
alexdima 42aff25
Merge remote-tracking branch 'origin/master' into robo/vscode-file
alexdima 71a03e1
support fetch api in vscode-file:
deepak1556 e88395e
Define node modules, to avoid attempting loading them as AMD modules
alexdima 5224c7e
Massage dom uris
alexdima d56bd13
Merge remote-tracking branch 'origin/master' into robo/vscode-file
alexdima ca503e7
Merge remote-tracking branch 'origin/master' into robo/vscode-file
alexdima b47e26a
Adopt `preferScriptTags`
alexdima 1fa495c
Fix a couple of tests
alexdima 9fedad2
Fix test on Windows
alexdima a417d00
Merge branch 'master' into robo/vscode-file
bpasero 2132f0f
Merge branch 'master' into robo/vscode-file
deepak1556 1de2e79
address review feedback
deepak1556 473cfd6
fix bad check
deepak1556 62c31e5
fix double encoding
deepak1556 8de656d
Merge branch 'origin/master' into robo/vscode-file
deepak1556 4539119
Merge branch 'origin/master' into robo/vscode-file
deepak1556 0e14a64
Merge branch 'master' into robo/vscode-file
bpasero c86abd4
Merge branch 'master' into robo/vscode-file
bpasero 7180a48
adopt new path for native env service interface
bpasero 24b5423
address review feedback
deepak1556 52c90cd
Merge remote-tracking branch 'origin' into robo/vscode-file
deepak1556 a3873d9
Merge remote-tracking branch 'origin' into robo/vscode-file
deepak1556 75e26bd
address review feedback
deepak1556 623990b
Merge branch 'master' into robo/vscode-file
bpasero 88809ba
some :lipstick:
bpasero 83c9a49
Merge branch 'master' into robo/vscode-file
bpasero e657360
Merge branch 'master' into robo/vscode-file
bpasero a1b667d
fix windows loading
bpasero a27854f
add v8CacheOptions (configurable via CLI arg)
bpasero 0400631
Merge branch 'master' into robo/vscode-file
bpasero 7347078
remove unused variables
bpasero e2316cf
clarify authority requirement
bpasero bcfc1a9
consolidate toCodeFileUri into LocalFileAccessImpl
bpasero 7431395
some clarifications
bpasero 81ec8ec
towards supporting authorities
bpasero 4726868
Merge branch 'master' into robo/vscode-file
bpasero 3fe9d3f
add some tests
bpasero ea4e572
fix tests
bpasero 53c881a
clarify comment
bpasero ff6b6cd
use getUriFromAmdModule
bpasero c1cb360
Merge branch 'master' into robo/vscode-file
bpasero f5513f0
fix webview working
bpasero c32d682
valid roots: add extension dev location too
bpasero 70b6ab0
:lipstick:
bpasero 01d9bd1
Merge branch 'master' into robo/vscode-file
bpasero faf30a7
fix duplicate import
bpasero 80e6e0c
touchbar - restore file protocol for icons
bpasero 894f1a8
refactor network methods to make meaning clear
bpasero 1529615
simplify moduleId usage
bpasero adb9b2c
further renames
bpasero 76f8e44
adopt FileAccess in more places
bpasero File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/*--------------------------------------------------------------------------------------------- | ||
* Copyright (c) Microsoft Corporation. All rights reserved. | ||
* Licensed under the MIT License. See License.txt in the project root for license information. | ||
*--------------------------------------------------------------------------------------------*/ | ||
|
||
import { Disposable, toDisposable } from 'vs/base/common/lifecycle'; | ||
import { Schemas } from 'vs/base/common/network'; | ||
import { URI } from 'vs/base/common/uri'; | ||
import { IEnvironmentService, INativeEnvironmentService } from 'vs/platform/environment/common/environment'; | ||
import { session } from 'electron'; | ||
|
||
export class FileProtocolHandler extends Disposable { | ||
|
||
constructor( | ||
@IEnvironmentService private readonly environmentService: INativeEnvironmentService | ||
) { | ||
super(); | ||
|
||
const { defaultSession } = session; | ||
|
||
const resourceHandler = this.handleResourceRequest.bind(this); | ||
deepak1556 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
defaultSession.protocol.registerFileProtocol(Schemas.vscodeFileResource, resourceHandler); | ||
deepak1556 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
this._register(toDisposable(() => { | ||
defaultSession.protocol.unregisterProtocol(Schemas.vscodeFileResource); | ||
})); | ||
} | ||
|
||
private async handleResourceRequest( | ||
request: Electron.Request, | ||
callback: any) { | ||
const uri = URI.parse(request.url); | ||
const appRoot = this.environmentService.appRoot; | ||
const extensionsPath = this.environmentService.extensionsPath; | ||
if (uri.path.startsWith(appRoot) || | ||
(extensionsPath && uri.path.startsWith(extensionsPath))) { | ||
return callback({ | ||
path: decodeURIComponent(uri.path) | ||
}); | ||
} | ||
console.error(`vscode-file: Refused to load resource ${uri.path}`); | ||
callback({ error: -3 /* ABORTED */ }); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about this use of
file
protocol?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have to check how UNC path works with custom protocol, didn't want to update this before that.