-
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 #409 from CodinGame/improve-filesystem-management
Improve filesystem management
- v11.1.2
- v11.1.1
- v11.1.0
- v11.0.2
- v11.0.1
- v11.0.0
- v10.1.4
- v10.1.3
- v10.1.2
- v10.1.1
- v10.1.0
- v10.0.2
- v10.0.1
- v10.0.0
- v9.0.4
- v9.0.3
- v9.0.2
- v9.0.1
- v9.0.0
- v8.0.4
- v8.0.3
- v8.0.2
- v8.0.1
- v8.0.0
- v7.1.1
- v7.1.0
- v7.0.11
- v7.0.10
- v7.0.9
- v7.0.8
- v7.0.7
- v7.0.6
- v7.0.5
- v7.0.4
- v7.0.3
- v7.0.2
- v7.0.1
- v7.0.0
- v6.0.3
- v6.0.2
- v6.0.1
- v6.0.0
- v5.3.0
- v5.2.0
- v5.1.2
- v5.1.2-segmenter.1
- v5.1.1
- v5.1.0
- v5.0.1
- v5.0.0
- v4.5.2
- v4.5.1
- v4.5.0
- v4.5.0-improve-code-splitting.1
- v4.4.1
- v4.4.0
Showing
13 changed files
with
367 additions
and
213 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,31 @@ | ||
import { ExtensionHostKind, registerExtension } from 'vscode/extensions' | ||
import { useHtmlFileSystemProvider } from '../setup.common' | ||
|
||
const { getApi } = registerExtension({ | ||
name: 'outputDemo', | ||
publisher: 'codingame', | ||
version: '1.0.0', | ||
engines: { | ||
vscode: '*' | ||
} | ||
}, ExtensionHostKind.LocalProcess) | ||
if (!useHtmlFileSystemProvider) { | ||
const { getApi } = registerExtension({ | ||
name: 'outputDemo', | ||
publisher: 'codingame', | ||
version: '1.0.0', | ||
engines: { | ||
vscode: '*' | ||
} | ||
}, ExtensionHostKind.LocalProcess) | ||
|
||
void getApi().then(async vscode => { | ||
const fakeOutputChannel = vscode.window.createOutputChannel('Fake output') | ||
const anotherFakeOutputChannel = vscode.window.createOutputChannel('Your code', 'javascript') | ||
void getApi().then(async vscode => { | ||
const fakeOutputChannel = vscode.window.createOutputChannel('Fake output') | ||
const anotherFakeOutputChannel = vscode.window.createOutputChannel('Your code', 'javascript') | ||
|
||
fakeOutputChannel.append('Here\'s some fake output\n') | ||
setInterval(() => { | ||
fakeOutputChannel.append('Hello world\n') | ||
}, 1000) | ||
fakeOutputChannel.append('Here\'s some fake output\n') | ||
setInterval(() => { | ||
fakeOutputChannel.append('Hello world\n') | ||
}, 1000) | ||
|
||
const mainDocument = await vscode.workspace.openTextDocument(vscode.Uri.file('/tmp/test.js')) | ||
anotherFakeOutputChannel.replace(mainDocument.getText()) | ||
vscode.workspace.onDidChangeTextDocument((e) => { | ||
if (e.document === mainDocument && e.contentChanges.length > 0) { | ||
anotherFakeOutputChannel.replace(e.document.getText()) | ||
} | ||
const mainDocument = await vscode.workspace.openTextDocument(vscode.Uri.file('/tmp/test.js')) | ||
anotherFakeOutputChannel.replace(mainDocument.getText()) | ||
vscode.workspace.onDidChangeTextDocument((e) => { | ||
if (e.document === mainDocument && e.contentChanges.length > 0) { | ||
anotherFakeOutputChannel.replace(e.document.getText()) | ||
} | ||
}) | ||
}) | ||
}) | ||
} |
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 |
---|---|---|
@@ -1,41 +1,44 @@ | ||
import { ExtensionHostKind, registerExtension } from 'vscode/extensions' | ||
import * as monaco from 'monaco-editor' | ||
import { useHtmlFileSystemProvider } from '../setup.common' | ||
|
||
const { getApi } = registerExtension({ | ||
name: 'searchProvider', | ||
publisher: 'codingame', | ||
version: '1.0.0', | ||
engines: { | ||
vscode: '*' | ||
}, | ||
enabledApiProposals: ['fileSearchProvider', 'textSearchProvider'] | ||
}, ExtensionHostKind.LocalProcess, { | ||
system: true // to be able to use api proposals | ||
}) | ||
|
||
void getApi().then(async api => { | ||
api.workspace.registerFileSearchProvider('file', { | ||
async provideFileSearchResults () { | ||
return monaco.editor.getModels().map(model => model.uri).filter(uri => uri.scheme === 'file') | ||
} | ||
if (!useHtmlFileSystemProvider) { | ||
const { getApi } = registerExtension({ | ||
name: 'searchProvider', | ||
publisher: 'codingame', | ||
version: '1.0.0', | ||
engines: { | ||
vscode: '*' | ||
}, | ||
enabledApiProposals: ['fileSearchProvider', 'textSearchProvider'] | ||
}, ExtensionHostKind.LocalProcess, { | ||
system: true // to be able to use api proposals | ||
}) | ||
api.workspace.registerTextSearchProvider('file', { | ||
async provideTextSearchResults (query, _, progress) { | ||
for (const model of monaco.editor.getModels()) { | ||
const matches = model.findMatches(query.pattern, false, query.isRegExp ?? false, query.isCaseSensitive ?? false, query.isWordMatch ?? false ? ' ' : null, true) | ||
if (matches.length > 0) { | ||
const ranges = matches.map(match => new api.Range(match.range.startLineNumber, match.range.startColumn, match.range.endLineNumber, match.range.endColumn)) | ||
progress.report({ | ||
uri: model.uri, | ||
ranges, | ||
preview: { | ||
text: model.getValue(), | ||
matches: ranges | ||
} | ||
}) | ||
|
||
void getApi().then(async api => { | ||
api.workspace.registerFileSearchProvider('file', { | ||
async provideFileSearchResults () { | ||
return monaco.editor.getModels().map(model => model.uri).filter(uri => uri.scheme === 'file') | ||
} | ||
}) | ||
api.workspace.registerTextSearchProvider('file', { | ||
async provideTextSearchResults (query, _, progress) { | ||
for (const model of monaco.editor.getModels()) { | ||
const matches = model.findMatches(query.pattern, false, query.isRegExp ?? false, query.isCaseSensitive ?? false, query.isWordMatch ?? false ? ' ' : null, true) | ||
if (matches.length > 0) { | ||
const ranges = matches.map(match => new api.Range(match.range.startLineNumber, match.range.startColumn, match.range.endLineNumber, match.range.endColumn)) | ||
progress.report({ | ||
uri: model.uri, | ||
ranges, | ||
preview: { | ||
text: model.getValue(), | ||
matches: ranges | ||
} | ||
}) | ||
} | ||
} | ||
return {} | ||
} | ||
return {} | ||
} | ||
}) | ||
}) | ||
}) | ||
} |
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
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,10 @@ | ||
import { create } from 'vs/workbench/services/search/worker/localFileSearch' | ||
import { SimpleWorkerServer } from 'vs/base/common/worker/simpleWorker' | ||
|
||
const simpleWorker = new SimpleWorkerServer((msg) => { | ||
globalThis.postMessage(msg) | ||
}, create) | ||
|
||
globalThis.onmessage = (e: MessageEvent) => { | ||
simpleWorker.onmessage(e.data) | ||
} |
41894a1
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.
🎉 Published on https://monaco-vscode-api.netlify.app as production
🚀 Deployed on https://6620df3b2b5122265f6c51fd--monaco-vscode-api.netlify.app