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

Mention autocomplete has stopped working #53

Open
mickmister opened this issue Mar 22, 2023 · 11 comments
Open

Mention autocomplete has stopped working #53

mickmister opened this issue Mar 22, 2023 · 11 comments

Comments

@mickmister
Copy link
Contributor

When I try to mention someone in a comment, no usernames show when I type @. In developer tools I see requests go out when I type @, and results come back in the response, but no results show in the UI.

@hediet
Copy link
Owner

hediet commented Mar 22, 2023

I noticed that too. Can you investigate why this doesn't work anymore?

@mickmister
Copy link
Contributor Author

I don't think I'll have the time to do this. Any tips on where to start?

@mickmister
Copy link
Contributor Author

@hediet I'm not sure how I triggered it, but this just worked once just now. Can't get it to work again though

@vbarrancos
Copy link

Also fails for mentioning issues/PRs after inputting a pound symbol. Not familiar with Chrome extension development and only slightly more familiar with async generators so haven't had the time to grok exactly how it works but I can at the very least see that issueUrl may not be being correctly set anymore.

Here is the error I'm seeing when I try to edit a PR in my work repo -- this.api.getIssueSuggestions appears to be returning undefined, and i.issueUrl (i is some minified identifier) is also undefined.
image

When I try to invoke the issue mention dropdown in this very comment, the dropdown fails to appear though I see a slightly different error in the console (maybe since this is the Issue page and not the PR page):
image

Once again issueUrl is undefined and you can see that in the outgoing request URL to the Github API.

@mickmister
Copy link
Contributor Author

and only slightly more familiar with async generators

@vbarrancos The complied/minified code is using generators, but the source code is just using async/await here:

} else {
const data = await this.api.getIssueSuggestions(urls.issueUrl);
return {
suggestions: data.suggestions.map((s) => ({
label: `#${s.number} (${s.title})`,
filterText: `#${s.title} ${s.number}`,
insertText: `#${s.number} `,
detail: `#${s.number}`,
kind: this.monaco.languages.CompletionItemKind.Function,
documentation: s.type,
range: range,
})),
};
}
}
}
const textTokenizer = (() => {
const b = new TokenizerBuilder<{ kind: "reference" | "mention" }>(
undefined
);

If urls.issueUrl is blank, then there must be an issue with how urls or its fields are getting set.

Maybe try putting a debugger statement on line 27 in the block below, to see if registerUrls is being called and with what arguments:

public registerUrls(
model: editor.ITextModel,
urls: { mentionUrl: string; issueUrl: string }
): void {
this.urls.set(model, urls);
}

@asherber
Copy link

image

Interestingly, I can see in the Network tab that calls are being made to the correct URLs, and JSON is getting returned. Are these calls made by the underlying textarea on the GitHub page, rather than by the Monaco text box?

(I'd love to see this fixed; it's my only real issue with the extension.)

@asherber
Copy link

Is there anything I can do to help troubleshoot this further? Debugging Chrome extensions isn't really my thing, but I'll do what I can. Would love to see this fixed.

@asherber
Copy link

I did some more poking around. In my case, the issue was complicated by the fact that I had enabled the beta Slash Commands feature in GitHub. This seems to change the value of this.editorRoot to a slash command provider, which is why the mention and issue urls weren't present in dataset. When I disabled this feature, I was able to see the expected urls, and now registerUrls is getting called with the expected arguments.

However, I'm still not getting suggestions. I set a breakpoint in provideCompletionItems, and that breakpoint never gets hit, even though a breakpoint in the constructor for GitHubCompletionController shows that the trigger characters are getting registered. (And even though the Network tab shows that requests are going out to the suggestions endpoint.)

@asherber
Copy link

I can see in the debugger that the text-expander is still capturing and processing the @ and # keystrokes.

@asherber
Copy link

Okay, time for me to eat crow. After noticing that mention and issue autocomplete was working for me on a different computer, I started comparing extensions, and then comparing settings, and it turns out that on my main machine I had turned off "Suggest on trigger characters" in the settings for this extension. When I turned it back on, the feature started working again. Go figure.

(I think when I first installed the extension I was annoyed by the regular word suggestions that were popping up as I typed, and without a good guide to what the settings all do, I just started turning off things that were related to suggestions.)

@mickmister
Copy link
Contributor Author

I've confirmed that I have Suggest on trigger characters enabled, but this is still broken for me. I would say this works for me 1 out of 200 times (generally never but sometimes does for some reason). No clue what makes it work sometimes. @vbarrancos Any luck on debugging this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants