-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
Consolidate all language definitions used in monaco within the @kbn/monaco package #208950
Merged
eokoneyo
merged 9 commits into
elastic:main
from
eokoneyo:chore/restructure-kbn-monaco-and-code-editor
Feb 18, 2025
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
0e06f91
migrate all language logic that doesn't relate to UI into kbn_monaco
eokoneyo 8ccc187
add test to verify that all supported langugages get registered on in…
eokoneyo 16e1bd4
export language definitions from code_editor
eokoneyo 303ae8d
consolidate all langugaes defintion for kbn/monaco to come from one e…
eokoneyo de1090f
[CI] Auto-commit changed files from 'node scripts/yarn_deduplicate'
kibanamachine 95e4c5b
[CI] Auto-commit changed files from 'node scripts/notice'
kibanamachine 6f829de
mark side effects within packages correctly
eokoneyo b358e30
slight adjustment for console language
eokoneyo b93a8bb
initialize monaco languages outside of code editor component context
eokoneyo 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
49 changes: 0 additions & 49 deletions
49
src/platform/packages/shared/kbn-monaco/src/console/index.ts
This file was deleted.
Oops, something went wrong.
30 changes: 0 additions & 30 deletions
30
src/platform/packages/shared/kbn-monaco/src/console/language.ts
This file was deleted.
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
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
File renamed without changes.
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
File renamed without changes.
27 changes: 27 additions & 0 deletions
27
src/platform/packages/shared/kbn-monaco/src/languages/console/index.ts
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,27 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the "Elastic License | ||
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side | ||
* Public License v 1"; you may not use this file except in compliance with, at | ||
* your election, the "Elastic License 2.0", the "GNU Affero General Public | ||
* License v3.0 only", or the "Server Side Public License, v 1". | ||
*/ | ||
|
||
/** | ||
* This import registers the Console monaco language contribution | ||
*/ | ||
import './language'; | ||
|
||
export { CONSOLE_LANG_ID, CONSOLE_OUTPUT_LANG_ID } from './constants'; | ||
|
||
export type { ParsedRequest } from './types'; | ||
export { | ||
getParsedRequestsProvider, | ||
ConsoleLang, | ||
ConsoleOutputLang, | ||
CONSOLE_THEME_ID, | ||
CONSOLE_OUTPUT_THEME_ID, | ||
} from './language'; | ||
export { ConsoleParsedRequestsProvider } from './console_parsed_requests_provider'; | ||
|
||
export { createOutputParser } from './output_parser'; |
61 changes: 61 additions & 0 deletions
61
src/platform/packages/shared/kbn-monaco/src/languages/console/language.ts
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,61 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the "Elastic License | ||
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side | ||
* Public License v 1"; you may not use this file except in compliance with, at | ||
* your election, the "Elastic License 2.0", the "GNU Affero General Public | ||
* License v3.0 only", or the "Server Side Public License, v 1". | ||
*/ | ||
|
||
import { setupConsoleErrorsProvider } from './console_errors_provider'; | ||
import { ConsoleWorkerProxyService } from './console_worker_proxy'; | ||
import { monaco } from '../../monaco_imports'; | ||
import { CONSOLE_LANG_ID, CONSOLE_OUTPUT_LANG_ID } from './constants'; | ||
import { ConsoleParsedRequestsProvider } from './console_parsed_requests_provider'; | ||
import { buildConsoleTheme } from './theme'; | ||
import type { LangModuleType } from '../../types'; | ||
|
||
const workerProxyService = new ConsoleWorkerProxyService(); | ||
|
||
import { | ||
lexerRules, | ||
languageConfiguration, | ||
consoleOutputLexerRules, | ||
consoleOutputLanguageConfiguration, | ||
} from './lexer_rules'; | ||
import { foldingRangeProvider } from './folding_range_provider'; | ||
|
||
/** | ||
* @description This language definition is used for the console input panel | ||
*/ | ||
export const ConsoleLang: LangModuleType = { | ||
ID: CONSOLE_LANG_ID, | ||
lexerRules, | ||
languageConfiguration, | ||
foldingRangeProvider, | ||
onLanguage: () => { | ||
workerProxyService.setup(); | ||
setupConsoleErrorsProvider(workerProxyService); | ||
}, | ||
languageThemeResolver: buildConsoleTheme, | ||
}; | ||
|
||
/** | ||
* @description This language definition is used for the console output panel | ||
*/ | ||
export const ConsoleOutputLang: LangModuleType = { | ||
ID: CONSOLE_OUTPUT_LANG_ID, | ||
lexerRules: consoleOutputLexerRules, | ||
languageConfiguration: consoleOutputLanguageConfiguration, | ||
foldingRangeProvider, | ||
}; | ||
|
||
// Theme id is the same as lang id, as we register only one theme resolver that's color mode aware | ||
export const CONSOLE_THEME_ID = CONSOLE_LANG_ID; | ||
|
||
// console output theme is the same as console theme | ||
export const CONSOLE_OUTPUT_THEME_ID = CONSOLE_THEME_ID; | ||
|
||
export const getParsedRequestsProvider = (model: monaco.editor.ITextModel | null) => { | ||
return new ConsoleParsedRequestsProvider(workerProxyService, model); | ||
}; |
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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.
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.
would it make sense to forbid importing monaco from @kbn/monaco and instead ask importing it from code_editor? (I don't know, just curious)
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 do agree, this is something worth exploring I created an issue for this.