-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Use Monaco editor in ConfigMap details #6830
Conversation
Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>
Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>
Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>
Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>
Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>
Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>
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.
Some questions.. Otherwise LGTM.
src/renderer/components/monaco-editor/get-editor-height-from-lines-number.injectable.ts
Outdated
Show resolved
Hide resolved
Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>
Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>
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.
LGTM
|
||
export type MonacoEditorSize = (linesCount: number) => number; | ||
|
||
const getEditorHeightFromLinesCountInjectable = getInjectable({ |
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.
So why in general do we need this function/feature to be *.injectable.ts
?
Any useful examples of how it would be utilized later in other envs? Or what's purpose in other words?
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.
It is implemented as injectable to follow de-facto standard and being able to inject it as dependency into MonacoEditor
:
export const MonacoEditor = withInjectables<Dependencies, MonacoEditorProps, MonacoEditorRef>(
React.forwardRef<MonacoEditorRef, MonacoEditorProps & Dependencies>((props, ref) => <NonInjectedMonacoEditor innerRef={ref} {...props} />),
{
getProps: (di, props) => ({
...props,
userStore: di.inject(userStoreInjectable),
activeTheme: di.inject(activeThemeInjectable),
getEditorHeightFromLinesCount: di.inject(getEditorHeightFromLinesCountInjectable),
}),
},
);
Without injectable
format it would be used from the shared state (eg. imported module) which is considered as bad practice.
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.
Alright, but why you've decided to control only height from MonacoEditor and this is why it's moved to injectable.ts
?
You still didn't answer my question: if you able to control height of the editor, when/where would be reused?
Some examples? Maybe builds for lens-ide
or lens-some-build
with different initial heights for the editor? This would make sense?
Fixes #6815 providing more useful editor with
Tab
key support forConfigMap
data entries.config.map.monaco.editor.mov