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

Autocomplete language for code block that targets Code playground with "custom language name" not supported by Pygments #23935

Closed
i-ky opened this issue Dec 28, 2022 · 3 comments · Fixed by #24011
Labels
area: compose (typeahead) Compose typeahead content and design help wanted

Comments

@i-ky
Copy link

i-ky commented Dec 28, 2022

Zulip autocompletes language of the code block:

// Start syntax highlighting autocompleter if the first three characters are ```
const syntax_token = current_token.slice(0, 3);
if (this.options.completions.syntax && (syntax_token === "```" || syntax_token === "~~~")) {
// Only autocomplete if user starts typing a language after ```
if (current_token.length === 3) {
return false;
}
// If the only input is a space, don't autocomplete
current_token = current_token.slice(3);
if (current_token === " ") {
return false;
}
// Trim the first whitespace if it is there
if (current_token[0] === " ") {
current_token = current_token.slice(1);
}
this.completing = "syntax";
this.token = current_token;
return Object.keys(pygments_data.langs);
}

...but suggestions are limited to languages supported by Pygments (pygments_data.langs).

Zulip also allows users to configure Code playgrounds with "custom language names":

You can also use a custom language name to implement simple integrations. For example, a code block tagged with the "language" send_tweet could be used with a "playground" that sends the content of the code block as a Tweet.

I think these "custom language names" should also be suggested by autocomplete feature.

For example, if send_tweet playground is configured in the organization and users types

```se

...then Zulip should suggest send_tweet.

@alya
Copy link
Contributor

alya commented Jan 2, 2023

Thanks for the suggestion @i-ky -- makes sense to me!

@alya alya added help wanted area: compose (typeahead) Compose typeahead content and design labels Jan 2, 2023
@tridentpancake
Copy link
Collaborator

@zulipbot claim

@zulipbot
Copy link
Member

zulipbot commented Jan 7, 2023

Hello @tridentpancake, it looks like you've currently claimed 1 issue in this repository. We encourage new contributors to focus their efforts on at most 1 issue at a time, so please complete your work on your other claimed issues before trying to claim this issue again.

We look forward to your valuable contributions!

tridentpancake added a commit to tridentpancake/zulip that referenced this issue Jan 7, 2023
tridentpancake added a commit to tridentpancake/zulip that referenced this issue Jan 7, 2023
tridentpancake added a commit to tridentpancake/zulip that referenced this issue Jan 9, 2023
tridentpancake added a commit to tridentpancake/zulip that referenced this issue Jan 9, 2023
tridentpancake added a commit to tridentpancake/zulip that referenced this issue Jan 9, 2023
tridentpancake added a commit to tridentpancake/zulip that referenced this issue Jan 10, 2023
timabbott pushed a commit to tridentpancake/zulip that referenced this issue Feb 25, 2023
timabbott pushed a commit to tridentpancake/zulip that referenced this issue Mar 1, 2023
timabbott pushed a commit to tridentpancake/zulip that referenced this issue Mar 2, 2023
bigBrain1901 pushed a commit to bigBrain1901/zulip that referenced this issue Mar 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: compose (typeahead) Compose typeahead content and design help wanted
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants