forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Consolidate all language definitions used in monaco within the @kbn/m…
…onaco package (elastic#208950) ## Summary This PR was created in response to elastic#208858, it migrates all existing language definitions within the `@kbn/code-editor` package into the `@kbn/monaco` package to provide a separation of concern for logic that doesn't particularly relate to the configurations for the code editor UI. With this change, all supported languages are ingested from the `@kbn/monaco` package where they will be domiciled from henceforth, and in turn fix the issue that was discovered relating to the way the language definitions within `@kbn/code-editor` get registered as a side effect. With this change, to add support for a new language, said language should be defined within `@kbn/monaco`, and registered in `languages/index.ts`. <!-- ### Checklist Check the PR satisfies following conditions. Reviewers should verify this PR satisfies this list as well. - [ ] Any text added follows [EUI's writing guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses sentence case text and includes [i18n support](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md) - [ ] [Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html) was added for features that require explanation or tutorials - [ ] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios - [ ] If a plugin configuration key changed, check if it needs to be allowlisted in the cloud and added to the [docker list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker) - [ ] This was checked for breaking HTTP API changes, and any breaking changes have been approved by the breaking-change committee. The `release_note:breaking` label should be applied in these situations. - [ ] [Flaky Test Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was used on any tests changed - [ ] The PR description includes the appropriate Release Notes section, and the correct `release_note:*` label is applied per the [guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process) ### Identify risks Does this PR introduce any risks? For example, consider risks like hard to test bugs, performance regression, potential of data loss. Describe the risk, its severity, and mitigation for each identified risk. Invite stakeholders and evaluate how to proceed before merging. - [ ] [See some risk examples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx) - [ ] ... --> --------- Co-authored-by: kibanamachine <[email protected]>
- Loading branch information
1 parent
a67154c
commit ff0470f
Showing
170 changed files
with
569 additions
and
446 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
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.