-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #128 from CodinGame/various-improvements
Various improvements and fixes
- Loading branch information
Showing
20 changed files
with
313 additions
and
191 deletions.
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,26 @@ | ||
import type * as vscode from 'vscode' | ||
import { IExtensionDescription } from 'vs/platform/extensions/common/extensions' | ||
import * as api from './api' | ||
import createL10nApi from './vscode-services/l10n' | ||
import createLanguagesApi from './vscode-services/languages' | ||
import createCommandsApi from './vscode-services/commands' | ||
import createWorkspaceApi from './vscode-services/workspace' | ||
import createWindowApi from './vscode-services/window' | ||
import createEnvApi from './vscode-services/env' | ||
import createDebugApi from './vscode-services/debug' | ||
import createExtensionsApi from './vscode-services/extensions' | ||
|
||
export default function createApi (extension: IExtensionDescription): typeof vscode { | ||
const workspace = createWorkspaceApi(() => extension) | ||
return { | ||
...api, | ||
extensions: createExtensionsApi(() => extension), | ||
debug: createDebugApi(() => extension), | ||
env: createEnvApi(() => extension), | ||
commands: createCommandsApi(() => extension), | ||
window: createWindowApi(() => extension, workspace), | ||
workspace: createWorkspaceApi(() => extension), | ||
languages: createLanguagesApi(() => extension), | ||
l10n: createL10nApi(() => extension) | ||
} | ||
} |
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,37 @@ | ||
import { IFileService } from 'vs/platform/files/common/files' | ||
import { StandaloneServices } from 'vs/editor/standalone/browser/standaloneServices' | ||
import { URI } from 'vs/base/common/uri' | ||
import { unsupported } from './tools' | ||
|
||
const fetch: typeof window.fetch = async (input: RequestInfo | URL, init?: RequestInit) => { | ||
if (typeof input === 'string') { | ||
const uri = URI.parse(input) | ||
const fileService = StandaloneServices.get(IFileService) | ||
if (fileService.hasProvider(uri)) { | ||
const response: Response = { | ||
get headers () { return unsupported() }, | ||
ok: true, | ||
redirected: false, | ||
status: 200, | ||
statusText: 'Ok', | ||
type: 'basic', | ||
url: input, | ||
clone: unsupported, | ||
get body () { return unsupported() }, | ||
bodyUsed: false, | ||
arrayBuffer: unsupported, | ||
blob: unsupported, | ||
formData: unsupported, | ||
json: unsupported, | ||
text: async function (): Promise<string> { | ||
const content = await fileService.readFile(URI.parse(input)) | ||
return content.value.toString() | ||
} | ||
} | ||
return response | ||
} | ||
} | ||
return window.fetch(input, init) | ||
} | ||
|
||
export default fetch |
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
Oops, something went wrong.