fix: autocompletion position messing up

This commit is contained in:
Andrew Bastin
2021-09-12 21:56:56 +05:30
parent 827a95515d
commit 631b2d869e
5 changed files with 5 additions and 37 deletions

View File

@@ -4,7 +4,7 @@ import { getAutocompleteSuggestions } from "graphql-language-service-interface"
import { Completer, CompleterResult, CompletionEntry } from "."
const completer: (schemaRef: Ref<GraphQLSchema | null>) => Completer =
(schemaRef: Ref<GraphQLSchema | null>) => (text, completePos, tokenPos) => {
(schemaRef: Ref<GraphQLSchema | null>) => (text, completePos) => {
if (!schemaRef.value) return Promise.resolve(null)
const completions = getAutocompleteSuggestions(schemaRef.value, text, {
@@ -13,8 +13,6 @@ const completer: (schemaRef: Ref<GraphQLSchema | null>) => Completer =
} as any)
return Promise.resolve(<CompleterResult>{
start: tokenPos.start,
end: tokenPos.end,
completions: completions.map(
(x, i) =>
<CompletionEntry>{