mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
CodeEditor: Trigger the lastest getSuggestions() passed to CodeEditor (#40544)
This commit is contained in:
parent
1f44023ebe
commit
9eccb8e416
@ -31,7 +31,10 @@ class UnthemedCodeEditor extends React.PureComponent<Props> {
|
|||||||
componentDidUpdate(oldProps: Props) {
|
componentDidUpdate(oldProps: Props) {
|
||||||
const { getSuggestions, language } = this.props;
|
const { getSuggestions, language } = this.props;
|
||||||
|
|
||||||
if (language !== oldProps.language) {
|
const newLanguage = oldProps.language !== language;
|
||||||
|
const newGetSuggestions = oldProps.getSuggestions !== getSuggestions;
|
||||||
|
|
||||||
|
if (newGetSuggestions || newLanguage) {
|
||||||
if (this.completionCancel) {
|
if (this.completionCancel) {
|
||||||
this.completionCancel.dispose();
|
this.completionCancel.dispose();
|
||||||
}
|
}
|
||||||
@ -44,7 +47,9 @@ class UnthemedCodeEditor extends React.PureComponent<Props> {
|
|||||||
if (getSuggestions) {
|
if (getSuggestions) {
|
||||||
this.completionCancel = registerSuggestions(this.monaco, language, getSuggestions);
|
this.completionCancel = registerSuggestions(this.monaco, language, getSuggestions);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (newLanguage) {
|
||||||
this.loadCustomLanguage();
|
this.loadCustomLanguage();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user