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

Consolidate all language definitions used in monaco within the @kbn/monaco package #208950

Merged

Conversation

eokoneyo
Copy link
Contributor

@eokoneyo eokoneyo commented Jan 30, 2025

Summary

This PR was created in response to #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.

@eokoneyo eokoneyo self-assigned this Jan 30, 2025
@eokoneyo

This comment was marked as outdated.

@eokoneyo eokoneyo force-pushed the chore/restructure-kbn-monaco-and-code-editor branch 2 times, most recently from 0ab27a8 to 0ee2273 Compare January 31, 2025 10:33
@eokoneyo

This comment was marked as duplicate.

@eokoneyo eokoneyo force-pushed the chore/restructure-kbn-monaco-and-code-editor branch 4 times, most recently from b9fc849 to f676ece Compare January 31, 2025 11:59
@eokoneyo

This comment was marked as duplicate.

1 similar comment
@eokoneyo
Copy link
Contributor Author

/ci

@eokoneyo eokoneyo force-pushed the chore/restructure-kbn-monaco-and-code-editor branch from f27a11c to 982fdca Compare February 3, 2025 10:49
@eokoneyo eokoneyo force-pushed the chore/restructure-kbn-monaco-and-code-editor branch from 982fdca to b84742b Compare February 5, 2025 17:23
@eokoneyo

This comment was marked as duplicate.

1 similar comment
@eokoneyo

This comment was marked as duplicate.

@elasticmachine
Copy link
Contributor

elasticmachine commented Feb 6, 2025

💔 Build Failed

Failed CI Steps

History

cc @eokoneyo

@eokoneyo eokoneyo force-pushed the chore/restructure-kbn-monaco-and-code-editor branch 2 times, most recently from 37fcb72 to 3d9deb9 Compare February 6, 2025 09:11
@eokoneyo

This comment was marked as duplicate.

1 similar comment
@eokoneyo

This comment was marked as duplicate.

@eokoneyo eokoneyo added release_note:skip Skip the PR/issue when compiling release notes Team:SharedUX Team label for AppEx-SharedUX (formerly Global Experience) labels Feb 6, 2025
@eokoneyo
Copy link
Contributor Author

eokoneyo commented Feb 6, 2025

/ci

@eokoneyo eokoneyo force-pushed the chore/restructure-kbn-monaco-and-code-editor branch from 9569ecd to b86742b Compare February 6, 2025 11:17
@eokoneyo
Copy link
Contributor Author

eokoneyo commented Feb 6, 2025

/ci

@eokoneyo eokoneyo force-pushed the chore/restructure-kbn-monaco-and-code-editor branch 3 times, most recently from 8e726f7 to 980b645 Compare February 6, 2025 13:03
@eokoneyo

This comment was marked as duplicate.

@Dosant
Copy link
Contributor

Dosant commented Feb 10, 2025

Does this have to be backported to 9.0? Doesn't seem like this is a bugfix

Copy link
Contributor

@nickofthyme nickofthyme left a comment

Choose a reason for hiding this comment

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

Vis changes LGTM

@eokoneyo eokoneyo force-pushed the chore/restructure-kbn-monaco-and-code-editor branch 2 times, most recently from f9f693e to e0359c8 Compare February 12, 2025 11:10
@ElenaStoeva ElenaStoeva self-requested a review February 12, 2025 13:42
Copy link
Member

@dmlemeshko dmlemeshko left a comment

Choose a reason for hiding this comment

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

test/tsconfig.json changes LGTM

@@ -21,8 +21,7 @@ export const getParsedRequestsProvider = (model: monaco.editor.ITextModel | null
};

// 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;
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it is confusing to use CONSOLE_LANG_ID instead of CONSOLE_THEME_ID for the following reason: Console has two languages - CONSOLE_LANG_ID (for the input panel) and CONSOLE_OUTPUT_LANG_ID (for the output panel) but both input and output editors have the same theme (with id CONSOLE_THEME_ID). With this new approach, the Output editor (in src/platform/plugins/shared/console/public/application/containers/editor/monaco_editor_output.tsx) would have CONSOLE_OUTPUT_LANG_ID language and CONSOLE_LANG_ID theme which doesn't make sense. I think we should keep the theme const - is there a reason why you wanted to remove it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fair enough, thanks for pointing out the distinction. It wasn't clear just by looking at the code, I made some adjustments in 17918d9; definitions for console and console output now reside within the language file, in addition there's a separate theme constant for both the input and output appearance.

@eokoneyo eokoneyo requested a review from ElenaStoeva February 14, 2025 11:18
@eokoneyo
Copy link
Contributor Author

@elasticmachine merge upstream

1 similar comment
@eokoneyo
Copy link
Contributor Author

@elasticmachine merge upstream

@eokoneyo eokoneyo removed the backport:prev-minor Backport to (9.0) the previous minor version (i.e. one version back from main) label Feb 17, 2025
@eokoneyo eokoneyo force-pushed the chore/restructure-kbn-monaco-and-code-editor branch from aead3fb to cc429c0 Compare February 17, 2025 11:40
@eokoneyo eokoneyo added the backport:skip This commit does not require backporting label Feb 17, 2025
Copy link
Contributor

@ElenaStoeva ElenaStoeva left a comment

Choose a reason for hiding this comment

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

Thanks for addressing my feedback @eokoneyo! Latest changes lgtm.

@eokoneyo eokoneyo force-pushed the chore/restructure-kbn-monaco-and-code-editor branch from cc429c0 to b93a8bb Compare February 18, 2025 16:09
@elasticmachine
Copy link
Contributor

💛 Build succeeded, but was flaky

Failed CI Steps

Test Failures

  • [job] [logs] FTR Configs #68 / Space awareness change space agent policies PUT /agent_policies/{id} should allow set policy in multiple space

Metrics [docs]

Public APIs missing comments

Total count of every public API that lacks a comment. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats comments for more detailed information.

id before after diff
@kbn/code-editor 17 25 +8
@kbn/monaco 138 186 +48
total +56

Any counts in public APIs

Total count of every any typed public API. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats any for more detailed information.

id before after diff
@kbn/monaco 0 6 +6

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
advancedSettings 36.2KB 36.2KB +6.0B
apm 2.3MB 2.3MB +5.0B
cloudDefend 95.0KB 95.0KB +4.0B
console 201.8KB 201.8KB +7.0B
grokdebugger 8.3KB 8.3KB +4.0B
infra 1.1MB 1.1MB +5.0B
observabilityAiAssistantManagement 106.9KB 106.9KB +5.0B
profiling 404.3KB 404.3KB +5.0B
telemetryManagementSection 31.4KB 31.4KB +5.0B
visTypeTimeseries 510.9KB 510.9KB +8.0B
visTypeVega 1.9MB 1.9MB +8.0B
total +62.0B

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
kbnUiSharedDeps-srcJs 3.6MB 3.6MB +3.8KB
kibanaReact 30.2KB 30.1KB -23.0B
total +3.7KB
Unknown metric groups

API count

id before after diff
@kbn/code-editor 41 49 +8
@kbn/monaco 138 186 +48
total +56

History

cc @eokoneyo

@eokoneyo eokoneyo merged commit ff0470f into elastic:main Feb 18, 2025
10 checks passed
@eokoneyo eokoneyo deleted the chore/restructure-kbn-monaco-and-code-editor branch February 18, 2025 18:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:skip This commit does not require backporting release_note:skip Skip the PR/issue when compiling release notes Team:SharedUX Team label for AppEx-SharedUX (formerly Global Experience) v9.1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants