Skip to content

Commit

Permalink
Merge pull request #375 from CodinGame/fix-editor-api-types
Browse files Browse the repository at this point in the history
Fix editor api types
  • Loading branch information
CGNonofr authored Mar 21, 2024
2 parents 9cea7ff + 0dd994c commit 0d76058
Show file tree
Hide file tree
Showing 13 changed files with 265 additions and 296 deletions.
2 changes: 1 addition & 1 deletion demo/.eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"browser": true
},
"parserOptions": {
"project": "./tsconfig.eslint.json"
"project": "./tsconfig.json"
},
"extends": [
"@codingame"
Expand Down
500 changes: 227 additions & 273 deletions demo/package-lock.json

Large diffs are not rendered by default.

18 changes: 10 additions & 8 deletions demo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,27 @@
"type": "module",
"scripts": {
"clean": "tsc -b -c",
"compile": "tsc",
"start": "NODE_OPTIONS=--experimental-import-meta-resolve vite --config vite.config.ts",
"start:debug": "vite --config vite.config.ts --debug --force",
"build": "vite --config vite.config.ts build",
"build:netlify": "tsc --noEmit && vite --config vite.netlify.config.ts build",
"lint": "eslint '{src/**/*.ts,rollup/*.ts,*.ts}'",
"typecheck": "tsc --noEmit",
"check-build": "npm run lint && npm run typecheck",
"build": "npm run check-build && vite --config vite.config.ts build",
"build:netlify": "npm run check-build && vite --config vite.netlify.config.ts build",
"start:debugServer": "node --loader ts-node/esm src/debugServer.ts",
"start:extHostServer": "WEB_ENDPOINT_URL_TEMPLATE=http://localhost:5173/ vscode-ext-host-server --without-connection-token"
},
"devDependencies": {
"@codingame/esbuild-import-meta-url-plugin": "^1.0.2",
"@codingame/monaco-vscode-rollup-vsix-plugin": "file:../dist/rollup-vsix-plugin",
"@types/dockerode": "^3.3.24",
"@types/dockerode": "^3.3.26",
"@types/express": "^4.17.21",
"@types/node": "^20.11.4",
"@types/wicg-file-system-access": "^2023.10.4",
"@types/wicg-file-system-access": "^2023.10.5",
"@types/ws": "^8.5.10",
"ts-node": "^10.9.2",
"typescript": "~5.3.3",
"vite": "~5.1.5"
"typescript": "~5.4.3",
"vite": "~5.2.2"
},
"dependencies": {
"@codingame/monaco-vscode-accessibility-service-override": "file:../dist/service-override-accessibility",
Expand Down Expand Up @@ -182,7 +184,7 @@
"@codingame/monaco-vscode-yaml-default-extension": "file:../dist/default-extension-yaml",
"ansi-colors": "^4.1.3",
"dockerode": "^4.0.2",
"express": "^4.18.3",
"express": "^4.19.1",
"monaco-editor": "file:../dist/editor-api",
"vscode": "file:../dist/main",
"ws": "^8.16.0"
Expand Down
2 changes: 1 addition & 1 deletion demo/src/features/customView.workbench.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ registerCustomView({
class CustomEditorPane extends SimpleEditorPane {
static readonly ID = 'workbench.editors.customEditor'

constructor ( ) {
constructor () {
super(CustomEditorPane.ID)
}

Expand Down
2 changes: 2 additions & 0 deletions demo/src/features/terminal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export class TerminalBackend extends SimpleTerminalBackend {
override onDidChangeProperty = propertyEmitter.event

override shutdown (immediate: boolean): void {
// eslint-disable-next-line no-console
console.log('shutdown', immediate)
}

Expand All @@ -47,6 +48,7 @@ export class TerminalBackend extends SimpleTerminalBackend {
}

resize (cols: number, rows: number): void {
// eslint-disable-next-line no-console
console.log('resize', cols, rows)
}

Expand Down
10 changes: 5 additions & 5 deletions demo/src/features/testing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,20 @@ void getApi().then(async api => {
const lines = text.split('\n')

for (let lineNo = 0; lineNo < lines.length; lineNo++) {
const line = lines[lineNo]
const line = lines[lineNo]!
const test = testRe.exec(line)
if (test != null) {
const [, a, operator, b, expected] = test
const range = new api.Range(new api.Position(lineNo, 0), new api.Position(lineNo, test[0].length))
events.onTest(range, Number(a), operator, Number(b), Number(expected))
events.onTest(range, Number(a), operator!, Number(b), Number(expected))
continue
}

const heading = headingRe.exec(line)
if (heading != null) {
const [, pounds, name] = heading
const range = new api.Range(new api.Position(lineNo, 0), new api.Position(lineNo, line.length))
events.onHeading(range, name, pounds.length)
events.onHeading(range, name!, pounds!.length)
}
}
}
Expand Down Expand Up @@ -91,7 +91,7 @@ void getApi().then(async api => {

parseMarkdown(content, {
onTest: (range, a, operator, b, expected) => {
const parent = ancestors[ancestors.length - 1]
const parent = ancestors[ancestors.length - 1]!
const data = new TestCase(a, operator as Operator, b, expected, thisGeneration)
const id = `${item.uri}/${data.getLabel()}`

Expand All @@ -103,7 +103,7 @@ void getApi().then(async api => {

onHeading: (range, name, depth) => {
ascend(depth)
const parent = ancestors[ancestors.length - 1]
const parent = ancestors[ancestors.length - 1]!
const id = `${item.uri}/${name}`

const thead = controller.createTestItem(id, name, item.uri)
Expand Down
1 change: 1 addition & 0 deletions demo/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"noImplicitReturns": true,
"baseUrl": ".",
"experimentalDecorators": true,
"noUncheckedIndexedAccess": true,
"paths": {
"vscode/vscode/*": ["../dist/main/vscode/src/*"],
"vscode/*": ["../dist/main/*"]
Expand Down
11 changes: 11 additions & 0 deletions monaco-vscode-api.code-workspace
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"folders": [
{
"path": "."
},
{
"path": "demo"
}
],
"settings": {}
}
5 changes: 3 additions & 2 deletions rollup/rollup.types.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -257,9 +257,10 @@ export default rollup.defineConfig((<{input: Record<string, string>, output: str
code = code.replace(`interface ${name} `, `type ${name} = ${value}\ninterface _${name} `)
}
})
return code
} else {
code = code.replace("declare module 'vs/editor/editor.api'", "declare module 'vscode/vscode/vs/editor/editor.api'")
}
return undefined
return code
},
renderChunk (code, chunk) {
const chunkParentPath = path.resolve(DIST_DIR, path.dirname(chunk.fileName))
Expand Down
3 changes: 1 addition & 2 deletions src/service-override/configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ import { IConfigurationService } from 'vs/platform/configuration/common/configur
import { ITextResourceConfigurationService, ITextResourcePropertiesService } from 'vs/editor/common/services/textResourceConfiguration'
import { TextResourceConfigurationService } from 'vs/editor/common/services/textResourceConfigurationService'
import { SyncDescriptor } from 'vs/platform/instantiation/common/descriptors'
import { ConfigurationScope } from 'vscode/src/vs/platform/configuration/common/configurationRegistry'
import { IConfigurationRegistry, Extensions as ConfigurationExtensions, IConfigurationNode, IConfigurationDefaults } from 'vs/platform/configuration/common/configurationRegistry'
import { ConfigurationScope, IConfigurationRegistry, Extensions as ConfigurationExtensions, IConfigurationNode, IConfigurationDefaults } from 'vs/platform/configuration/common/configurationRegistry'
import { Registry } from 'vs/platform/registry/common/platform'
import { VSBuffer } from 'vs/base/common/buffer'
import { IFileService, IFileWriteOptions } from 'vs/platform/files/common/files'
Expand Down
3 changes: 1 addition & 2 deletions src/service-override/files.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ import { FileService } from 'vs/platform/files/common/fileService'
import { ILogService } from 'vs/platform/log/common/log'
import { InMemoryFileSystemProvider } from 'vs/platform/files/common/inMemoryFilesystemProvider'
import { URI } from 'vs/base/common/uri'
import { FileChangeType, FilePermission, FileSystemProviderCapabilities, FileType, IFileSystemProvider, toFileSystemProviderErrorCode } from 'vscode/src/vs/platform/files/common/files'
import { createFileSystemProviderError, FileSystemProviderError, FileSystemProviderErrorCode, IFileChange, IFileDeleteOptions, IFileOverwriteOptions, IFileService, IFileSystemProviderWithFileReadWriteCapability, IFileWriteOptions, IStat, IWatchOptions } from 'vs/platform/files/common/files'
import { FileChangeType, FilePermission, FileSystemProviderCapabilities, FileType, IFileSystemProvider, toFileSystemProviderErrorCode, createFileSystemProviderError, FileSystemProviderError, FileSystemProviderErrorCode, IFileChange, IFileDeleteOptions, IFileOverwriteOptions, IFileService, IFileSystemProviderWithFileReadWriteCapability, IFileWriteOptions, IStat, IWatchOptions } from 'vs/platform/files/common/files'
import { DisposableStore, IDisposable, Disposable, toDisposable } from 'vs/base/common/lifecycle'
import { extUri, joinPath } from 'vs/base/common/resources'
import { Emitter, Event } from 'vs/base/common/event'
Expand Down
1 change: 1 addition & 0 deletions src/service-override/terminal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import 'vs/workbench/contrib/terminal/browser/terminal.contribution'
import 'vs/workbench/contrib/terminal/terminal.all'
import 'vs/workbench/contrib/externalTerminal/browser/externalTerminal.contribution'
import 'vs/workbench/contrib/terminal/browser/terminal.web.contribution'
export { ITerminalService, ITerminalInstanceService } from 'vs/workbench/contrib/terminal/browser/terminal'

abstract class SimpleTerminalBackend implements ITerminalBackend {
getLatency = async (): Promise<IPtyHostLatencyMeasurement[]> => []
Expand Down
3 changes: 1 addition & 2 deletions src/services.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import Severity from 'vs/base/common/severity'
import { IConfigurationChangeEvent } from 'vs/platform/configuration/common/configuration'
import { ITextModelContentProvider } from 'vs/editor/common/services/resolverService'
import { IColorTheme } from 'vs/platform/theme/common/themeService'
import { StorageScope, StorageTarget } from 'vscode/src/vs/platform/storage/common/storage'
import { StorageScope, StorageTarget } from 'vs/platform/storage/common/storage'
import { IEditorOverrideServices, StandaloneServices } from 'vs/editor/standalone/browser/standaloneServices'
import { mixin } from 'vs/base/common/objects'
import { GetLeadingNonServiceArgs, IInstantiationService, ServiceIdentifier, ServicesAccessor } from 'vs/platform/instantiation/common/instantiation'
Expand Down Expand Up @@ -200,7 +200,6 @@ export { IHistoryService, GoFilter, GoScope } from 'vs/workbench/services/histor
export { IRemoteAgentService } from 'vs/workbench/services/remote/common/remoteAgentService'
export { IRemoteAuthorityResolverService } from 'vs/platform/remote/common/remoteAuthorityResolver'
export { IRemoteSocketFactoryService } from 'vs/platform/remote/common/remoteSocketFactoryService'
export { ITerminalService, ITerminalInstanceService } from 'vs/workbench/contrib/terminal/browser/terminal'
export { IFilesConfigurationService } from 'vs/workbench/services/filesConfiguration/common/filesConfigurationService'
export { ILabelService } from 'vs/platform/label/common/label'
export { IWorkbenchLayoutService } from 'vs/workbench/services/layout/browser/layoutService'
Expand Down

1 comment on commit 0d76058

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.