Skip to content
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

Refactor initialization #97

Merged
merged 8 commits into from
Feb 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
8 changes: 4 additions & 4 deletions .github/workflows/check_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ jobs:
name: Lint commits
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
# we actually need "github.event.pull_request.commits + 1" commit
fetch-depth: 0
- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
- run: npm ci
- run: npx commitlint --from ${{ github.event.pull_request.head.sha }}~${{ github.event.pull_request.commits }} --to ${{ github.event.pull_request.head.sha }} --verbose
check:
Expand All @@ -22,11 +22,11 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 20.10.0
- name: Install dependencies
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 20.10.0
- name: Install dependencies
Expand Down
2 changes: 1 addition & 1 deletion commitlint.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module.exports = {
export default {
extends: ['@codingame/commitlint-config-codingame']
};
9,825 changes: 2,906 additions & 6,919 deletions package-lock.json

Large diffs are not rendered by default.

179 changes: 100 additions & 79 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"main": "dist/main.js",
"module": "dist/main.js",
"types": "dist/index.d.ts",
"type": "module",
"exports": {
".": {
"default": "./dist/main.js"
Expand All @@ -42,6 +43,14 @@
"./features/extensionHostWorker": {
"types": "./dist/features/extensionHostWorker.d.ts",
"default": "./dist/features/extensionHostWorker.js"
},
"./features/notifications": {
"types": "./dist/features/notifications.d.ts",
"default": "./dist/features/notifications.js"
},
"./features/extensionGallery": {
"types": "./dist/features/extensionGallery.d.ts",
"default": "./dist/features/extensionGallery.js"
}
},
"typesVersions": {
Expand All @@ -60,6 +69,12 @@
],
"features/extensionHostWorker": [
"./dist/features/extensionHostWorker.d.ts"
],
"features/notitications": [
"./dist/features/notitications.d.ts"
],
"features/extensionGallery": [
"./dist/features/extensionGallery.d.ts"
]
}
},
Expand All @@ -68,95 +83,97 @@
"stats.html"
],
"dependencies": {
"@codingame/monaco-vscode-accessibility-service-override": "^2.1.1",
"@codingame/monaco-vscode-audio-cue-service-override": "^2.1.1",
"@codingame/monaco-vscode-clojure-default-extension": "^2.1.1",
"@codingame/monaco-vscode-coffeescript-default-extension": "^2.1.1",
"@codingame/monaco-vscode-configuration-editing-default-extension": "^2.1.1",
"@codingame/monaco-vscode-configuration-service-override": "^2.1.1",
"@codingame/monaco-vscode-cpp-default-extension": "^2.1.1",
"@codingame/monaco-vscode-csharp-default-extension": "^2.1.1",
"@codingame/monaco-vscode-css-default-extension": "^2.1.1",
"@codingame/monaco-vscode-debug-service-override": "^2.1.1",
"@codingame/monaco-vscode-dialogs-service-override": "^2.1.1",
"@codingame/monaco-vscode-diff-default-extension": "^2.1.1",
"@codingame/monaco-vscode-editor-service-override": "^2.1.1",
"@codingame/monaco-vscode-extensions-service-override": "^2.1.1",
"@codingame/monaco-vscode-files-service-override": "^2.1.1",
"@codingame/monaco-vscode-fsharp-default-extension": "^2.1.1",
"@codingame/monaco-vscode-go-default-extension": "^2.1.1",
"@codingame/monaco-vscode-groovy-default-extension": "^2.1.1",
"@codingame/monaco-vscode-html-default-extension": "^2.1.1",
"@codingame/monaco-vscode-java-default-extension": "^2.1.1",
"@codingame/monaco-vscode-javascript-default-extension": "^2.1.1",
"@codingame/monaco-vscode-json-default-extension": "^2.1.1",
"@codingame/monaco-vscode-julia-default-extension": "^2.1.1",
"@codingame/monaco-vscode-keybindings-service-override": "^2.1.1",
"@codingame/monaco-vscode-language-detection-worker-service-override": "^2.1.1",
"@codingame/monaco-vscode-languages-service-override": "^2.1.1",
"@codingame/monaco-vscode-lifecycle-service-override": "^2.1.1",
"@codingame/monaco-vscode-log-service-override": "^2.1.1",
"@codingame/monaco-vscode-lua-default-extension": "^2.1.1",
"@codingame/monaco-vscode-markdown-basics-default-extension": "^2.1.1",
"@codingame/monaco-vscode-markdown-language-features-default-extension": "^2.1.1",
"@codingame/monaco-vscode-markdown-math-default-extension": "^2.1.1",
"@codingame/monaco-vscode-markers-service-override": "^2.1.1",
"@codingame/monaco-vscode-media-preview-default-extension": "^2.1.1",
"@codingame/monaco-vscode-model-service-override": "^2.1.1",
"@codingame/monaco-vscode-npm-default-extension": "^2.1.1",
"@codingame/monaco-vscode-objective-c-default-extension": "^2.1.1",
"@codingame/monaco-vscode-output-service-override": "^2.1.1",
"@codingame/monaco-vscode-perl-default-extension": "^2.1.1",
"@codingame/monaco-vscode-php-default-extension": "^2.1.1",
"@codingame/monaco-vscode-powershell-default-extension": "^2.1.1",
"@codingame/monaco-vscode-preferences-service-override": "^2.1.1",
"@codingame/monaco-vscode-python-default-extension": "^2.1.1",
"@codingame/monaco-vscode-quickaccess-service-override": "^2.1.1",
"@codingame/monaco-vscode-r-default-extension": "^2.1.1",
"@codingame/monaco-vscode-references-view-default-extension": "^2.1.1",
"@codingame/monaco-vscode-ruby-default-extension": "^2.1.1",
"@codingame/monaco-vscode-rust-default-extension": "^2.1.1",
"@codingame/monaco-vscode-scss-default-extension": "^2.1.1",
"@codingame/monaco-vscode-search-result-default-extension": "^2.1.1",
"@codingame/monaco-vscode-search-service-override": "^2.1.1",
"@codingame/monaco-vscode-shellscript-default-extension": "^2.1.1",
"@codingame/monaco-vscode-snippets-service-override": "^2.1.1",
"@codingame/monaco-vscode-sql-default-extension": "^2.1.1",
"@codingame/monaco-vscode-storage-service-override": "^2.1.1",
"@codingame/monaco-vscode-swift-default-extension": "^2.1.1",
"@codingame/monaco-vscode-textmate-service-override": "^2.1.1",
"@codingame/monaco-vscode-theme-defaults-default-extension": "^2.1.1",
"@codingame/monaco-vscode-theme-service-override": "^2.1.1",
"@codingame/monaco-vscode-theme-seti-default-extension": "^2.1.1",
"@codingame/monaco-vscode-typescript-basics-default-extension": "^2.1.1",
"@codingame/monaco-vscode-vb-default-extension": "^2.1.1",
"@codingame/monaco-vscode-view-status-bar-service-override": "^2.1.1",
"@codingame/monaco-vscode-views-service-override": "^2.1.1",
"@codingame/monaco-vscode-working-copy-service-override": "^2.1.1",
"@codingame/monaco-vscode-xml-default-extension": "^2.1.1",
"@codingame/monaco-vscode-yaml-default-extension": "^2.1.1",
"monaco-editor": "npm:@codingame/monaco-vscode-editor-api@^2.1.1",
"vscode": "npm:@codingame/monaco-vscode-api@^2.1.1"
"@codingame/monaco-vscode-accessibility-service-override": "^2.1.3",
"@codingame/monaco-vscode-audio-cue-service-override": "^2.1.3",
"@codingame/monaco-vscode-clojure-default-extension": "^2.1.3",
"@codingame/monaco-vscode-coffeescript-default-extension": "^2.1.3",
"@codingame/monaco-vscode-configuration-editing-default-extension": "^2.1.3",
"@codingame/monaco-vscode-configuration-service-override": "^2.1.3",
"@codingame/monaco-vscode-cpp-default-extension": "^2.1.3",
"@codingame/monaco-vscode-csharp-default-extension": "^2.1.3",
"@codingame/monaco-vscode-css-default-extension": "^2.1.3",
"@codingame/monaco-vscode-debug-service-override": "^2.1.3",
"@codingame/monaco-vscode-dialogs-service-override": "^2.1.3",
"@codingame/monaco-vscode-diff-default-extension": "^2.1.3",
"@codingame/monaco-vscode-editor-service-override": "^2.1.3",
"@codingame/monaco-vscode-extension-gallery-service-override": "^2.1.3",
"@codingame/monaco-vscode-extensions-service-override": "^2.1.3",
"@codingame/monaco-vscode-files-service-override": "^2.1.3",
"@codingame/monaco-vscode-fsharp-default-extension": "^2.1.3",
"@codingame/monaco-vscode-go-default-extension": "^2.1.3",
"@codingame/monaco-vscode-groovy-default-extension": "^2.1.3",
"@codingame/monaco-vscode-html-default-extension": "^2.1.3",
"@codingame/monaco-vscode-java-default-extension": "^2.1.3",
"@codingame/monaco-vscode-javascript-default-extension": "^2.1.3",
"@codingame/monaco-vscode-json-default-extension": "^2.1.3",
"@codingame/monaco-vscode-julia-default-extension": "^2.1.3",
"@codingame/monaco-vscode-keybindings-service-override": "^2.1.3",
"@codingame/monaco-vscode-language-detection-worker-service-override": "^2.1.3",
"@codingame/monaco-vscode-languages-service-override": "^2.1.3",
"@codingame/monaco-vscode-lifecycle-service-override": "^2.1.3",
"@codingame/monaco-vscode-log-service-override": "^2.1.3",
"@codingame/monaco-vscode-lua-default-extension": "^2.1.3",
"@codingame/monaco-vscode-markdown-basics-default-extension": "^2.1.3",
"@codingame/monaco-vscode-markdown-language-features-default-extension": "^2.1.3",
"@codingame/monaco-vscode-markdown-math-default-extension": "^2.1.3",
"@codingame/monaco-vscode-markers-service-override": "^2.1.3",
"@codingame/monaco-vscode-media-preview-default-extension": "^2.1.3",
"@codingame/monaco-vscode-model-service-override": "^2.1.3",
"@codingame/monaco-vscode-notifications-service-override": "^2.1.3",
"@codingame/monaco-vscode-npm-default-extension": "^2.1.3",
"@codingame/monaco-vscode-objective-c-default-extension": "^2.1.3",
"@codingame/monaco-vscode-output-service-override": "^2.1.3",
"@codingame/monaco-vscode-perl-default-extension": "^2.1.3",
"@codingame/monaco-vscode-php-default-extension": "^2.1.3",
"@codingame/monaco-vscode-powershell-default-extension": "^2.1.3",
"@codingame/monaco-vscode-preferences-service-override": "^2.1.3",
"@codingame/monaco-vscode-python-default-extension": "^2.1.3",
"@codingame/monaco-vscode-quickaccess-service-override": "^2.1.3",
"@codingame/monaco-vscode-r-default-extension": "^2.1.3",
"@codingame/monaco-vscode-references-view-default-extension": "^2.1.3",
"@codingame/monaco-vscode-ruby-default-extension": "^2.1.3",
"@codingame/monaco-vscode-rust-default-extension": "^2.1.3",
"@codingame/monaco-vscode-scss-default-extension": "^2.1.3",
"@codingame/monaco-vscode-search-result-default-extension": "^2.1.3",
"@codingame/monaco-vscode-search-service-override": "^2.1.3",
"@codingame/monaco-vscode-shellscript-default-extension": "^2.1.3",
"@codingame/monaco-vscode-snippets-service-override": "^2.1.3",
"@codingame/monaco-vscode-sql-default-extension": "^2.1.3",
"@codingame/monaco-vscode-storage-service-override": "^2.1.3",
"@codingame/monaco-vscode-swift-default-extension": "^2.1.3",
"@codingame/monaco-vscode-textmate-service-override": "^2.1.3",
"@codingame/monaco-vscode-theme-defaults-default-extension": "^2.1.3",
"@codingame/monaco-vscode-theme-service-override": "^2.1.3",
"@codingame/monaco-vscode-theme-seti-default-extension": "^2.1.3",
"@codingame/monaco-vscode-typescript-basics-default-extension": "^2.1.3",
"@codingame/monaco-vscode-vb-default-extension": "^2.1.3",
"@codingame/monaco-vscode-view-status-bar-service-override": "^2.1.3",
"@codingame/monaco-vscode-views-service-override": "^2.1.3",
"@codingame/monaco-vscode-working-copy-service-override": "^2.1.3",
"@codingame/monaco-vscode-xml-default-extension": "^2.1.3",
"@codingame/monaco-vscode-yaml-default-extension": "^2.1.3",
"@codingame/semantic-release-config-github": "^1.0.0",
"monaco-editor": "npm:@codingame/monaco-vscode-editor-api@^2.1.3",
"vscode": "npm:@codingame/monaco-vscode-api@^2.1.3"
},
"devDependencies": {
"@codingame/commitlint-config-codingame": "^1.0.7",
"@codingame/commitlint-config-codingame": "^1.0.10",
"@codingame/eslint-config": "^1.1.10",
"@codingame/monaco-vscode-rollup-vsix-plugin": "^2.1.1",
"@codingame/semantic-release-config": "^1.3.5",
"@codingame/monaco-vscode-rollup-vsix-plugin": "^2.1.3",
"@codingame/tsconfig": "^1.1.1",
"@commitlint/cli": "^18.6.0",
"@commitlint/cli": "^18.6.1",
"@rollup/plugin-alias": "5.1.0",
"@rollup/plugin-commonjs": "25.0.7",
"@rollup/plugin-json": "6.1.0",
"@rollup/plugin-node-resolve": "15.2.3",
"@rollup/plugin-typescript": "^11.1.6",
"@types/ini": "4.1.0",
"@types/js-yaml": "^4.0.9",
"@types/node": "20.11.16",
"@types/node": "20.11.17",
"@types/rollup-plugin-node-builtins": "^2.1.5",
"@types/vscode": "~1.86.0",
"@typescript-eslint/eslint-plugin": "6.21.0",
"@typescript-eslint/parser": "6.21.0",
"@typescript-eslint/eslint-plugin": "7.0.1",
"@typescript-eslint/parser": "7.0.1",
"@vscode/vsce": "^2.23.0",
"azure-devops-node-api": "^12.4.0",
"conventional-changelog-conventionalcommits": "^7.0.2",
Expand All @@ -176,7 +193,7 @@
"monaco-emacs": "^0.3.0",
"monaco-vim": "^0.4.1",
"postcss": "8.4.35",
"rollup": "4.9.6",
"rollup": "4.10.0",
"rollup-plugin-node-builtins": "^2.1.2",
"rollup-plugin-visualizer": "5.12.0",
"ts-node": "10.9.2",
Expand All @@ -195,9 +212,13 @@
"node": "20.10.0",
"npm": "10.4.0"
},
"release": {
"extends": "@codingame/semantic-release-config-github"
},
"overrides": {
"monaco-editor": "$monaco-editor",
"rollup": "4.9.6",
"typescript": "5.3.3"
"rollup": "4.10.0",
"typescript": "5.3.3",
"@typescript-eslint/eslint-plugin": "$@typescript-eslint/eslint-plugin"
}
}
13 changes: 0 additions & 13 deletions release.config.js

This file was deleted.

4 changes: 3 additions & 1 deletion rollup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ export default rollup.defineConfig({
'features/viewPanels': 'src/features/viewPanels.ts',
'features/search': 'src/features/search.ts',
'features/debug': 'src/features/debug.ts',
'features/extensionHostWorker': 'src/features/extensionHostWorker.ts'
'features/extensionHostWorker': 'src/features/extensionHostWorker.ts',
'features/notifications': 'src/features/notifications.ts',
'features/extensionGallery': 'src/features/extensionGallery.ts'
},
external: function isExternal (source, importer, isResolved) {
if (isResolved) {
Expand Down
6 changes: 6 additions & 0 deletions src/features/extensionGallery.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import getExtensionGalleryServiceOverride from '@codingame/monaco-vscode-extension-gallery-service-override'
import { registerServices } from '../services'

registerServices({
...getExtensionGalleryServiceOverride()
})
6 changes: 6 additions & 0 deletions src/features/notifications.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import getNotificationsServiceOverride from '@codingame/monaco-vscode-notifications-service-override'
import { registerServices } from '../services'

registerServices({
...getNotificationsServiceOverride()
})
7 changes: 5 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
import * as monaco from 'monaco-editor'
import { createEditor, createModelReference, registerEditorOpenHandler, initializePromise } from './monaco'
import { createEditor, createModelReference, registerEditorOpenHandler } from './monaco'
import { updateUserConfiguration, registerConfigurations, registerDefaultConfigurations, onConfigurationChanged, getConfiguration, getUserConfiguration, onUserConfigurationChange } from './configuration'
import { getMonacoLanguage, loadLanguage } from './languages'
import { updateKeybindings, updateEditorKeybindingsMode } from './keybindings'
import { generateAndInitializeWorkspace, initialize, initializePromise, isInitialized, setUseGlobalPicker } from './services'
import './style'
import { setUseGlobalPicker } from './services'
export * from './tools'

export {
monaco,
initialize,
generateAndInitializeWorkspace,
isInitialized,
initializePromise,
createEditor,
createModelReference,
Expand Down
8 changes: 2 additions & 6 deletions src/monaco.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as monaco from 'monaco-editor'
import { IReference, ITextFileEditorModel, createConfiguredEditor, errorHandler, createModelReference as vscodeCreateModelReference } from 'vscode/monaco'
import { initialize, editorOpenHandlerRegistry } from './services'
import { editorOpenHandlerRegistry, initializePromise, isInitialized } from './services'
import './languages'
import './theme'
import './worker'
Expand All @@ -11,11 +11,8 @@ errorHandler.setUnexpectedErrorHandler(error => {
console.warn('Unexpected error', error)
})

let initialized = false
const initializePromise = initialize().then(() => { initialized = true })

function createEditor (domElement: HTMLElement, options?: monaco.editor.IStandaloneEditorConstructionOptions): monaco.editor.IStandaloneCodeEditor {
if (!initialized) {
if (!isInitialized()) {
throw new Error('Monaco not initialized')
}
const editor = createConfiguredEditor(domElement, options)
Expand All @@ -35,7 +32,6 @@ function registerEditorOpenHandler (handler: EditorOpenHandler): monaco.IDisposa
}

export {
initializePromise,
createEditor,
createModelReference,
registerEditorOpenHandler
Expand Down
Loading
Loading