Small codemirror changes (#2898)
* Drop unneeded compute indirection in lspAutocompleteKeymapExt * Dispatch only a single transaction in requestFormatting Remove addToHistory.of(true), since that is the default. * Remove old comment and some useless tests * Just store the view, not the previous viewUpdate, in CompletionRequester * small codemirror changes from marijnh Signed-off-by: Jess Frazelle <github@jessfraz.com> * fix some flaky tests Signed-off-by: Jess Frazelle <github@jessfraz.com> * fix Signed-off-by: Jess Frazelle <github@jessfraz.com> * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> --------- Signed-off-by: Jess Frazelle <github@jessfraz.com> Co-authored-by: Marijn Haverbeke <marijn@haverbeke.berlin>
This commit is contained in:
@ -284,19 +284,16 @@ export class LanguageServerPlugin implements PluginValue {
|
||||
},
|
||||
})
|
||||
|
||||
if (!result) return null
|
||||
if (!result || !result.length) return null
|
||||
|
||||
for (let i = 0; i < result.length; i++) {
|
||||
const { range, newText } = result[i]
|
||||
this.view.dispatch({
|
||||
changes: {
|
||||
from: posToOffset(this.view.state.doc, range.start)!,
|
||||
to: posToOffset(this.view.state.doc, range.end)!,
|
||||
insert: newText,
|
||||
},
|
||||
annotations: [lspFormatCodeEvent, Transaction.addToHistory.of(true)],
|
||||
})
|
||||
}
|
||||
this.view.dispatch({
|
||||
changes: result.map(({ range, newText }) => ({
|
||||
from: posToOffset(this.view.state.doc, range.start)!,
|
||||
to: posToOffset(this.view.state.doc, range.end)!,
|
||||
insert: newText,
|
||||
})),
|
||||
annotations: lspFormatCodeEvent,
|
||||
})
|
||||
}
|
||||
|
||||
async requestCompletion(
|
||||
|
Reference in New Issue
Block a user