Use an empty vim install and open the below .tsx file and type :syntax on.
You will see that only the top of the file is highlighted and after a bit of navigation vim crashes.
This was already reported at Herrington's repository here: HerringtonDarkholme/yats.vim#292
Here's an example .tsx file.
import { ChatBarButton, ChatBarButtonFactory } from "@api/ChatButtons";
import { Devs } from "@utils/constants";
import { sleep } from "@utils/misc";
import definePlugin from "@utils/types";
import { findByPropsLazy, findStoreLazy } from "@webpack";
import { DateUtils, FluxDispatcher, MessageStore, SelectedChannelStore, Tooltip, React, useState, useStateFromStores } from "@webpack/common";
import { Message } from "discord-types/general";
const MessageActions = findByPropsLazy("fetchMessages", "sendMessage");
function getTotalReactions(message: Message): number {
if (!message?.reactions) {
return 0;
}
return message.reactions.reduce((sum, reaction) => sum + (reaction.count ?? 0), 0);
}
function getOldestMessage(channelId: string): Message | undefined {
const messagesObj = MessageStore.getMessages(channelId);
const currentMessages = messagesObj?._array ?? [];
return currentMessages.reduce((oldest, msg) => {
if (!oldest || BigInt(msg.id) < BigInt(oldest.id)) {
return msg;
}
return oldest;
}, undefined as Message | undefined);
}
const LoadAndSortButton: ChatBarButtonFactory = ({ isMainChat }) => {
if (!isMainChat) return null;
const [isLoading, setIsLoading] = useState(false);
const currentChannelId = SelectedChannelStore.getChannelId();
const oldestMessageTimestampText = useStateFromStores(
[MessageStore, SelectedChannelStore],
() => {
const chanId = SelectedChannelStore.getChannelId();
if (!chanId) return "";
const oldestMsg = getOldestMessage(chanId);
if (!oldestMsg) return "";
return DateUtils.calendarFormat(oldestMsg.timestamp);
}
);
const handleLoadAndSortClick = async () => {
const channelId = SelectedChannelStore.getChannelId();
if (!channelId || isLoading) {
return;
}
if (!MessageActions?.fetchMessages) {
return;
}
setIsLoading(true);
const FETCH_LIMIT = 100;
let fetchError = null;
try {
const oldestMsg = getOldestMessage(channelId);
await MessageActions.fetchMessages({
channelId: channelId,
limit: FETCH_LIMIT,
before: oldestMsg?.id,
});
await sleep(100);
const messagesObj = MessageStore.getMessages(channelId);
const messagesArray = messagesObj?._array;
if (messagesArray && messagesArray.length > 0) {
messagesArray.sort((a, b) => getTotalReactions(a) - getTotalReactions(b));
if (messagesArray.length > 0) {
FluxDispatcher.dispatch({
type: "MESSAGE_UPDATE",
message: messagesArray[messagesArray.length - 1],
logMuted: true,
});
}
}
} catch (error) {
fetchError = error;
console.error(`Failed to fetch/sort messages for channel ${channelId}:`, error);
} finally {
setIsLoading(false);
}
};
const containerStyle: React.CSSProperties = {
display: 'flex',
alignItems: 'center',
gap: '8px',
};
const timestampStyle: React.CSSProperties = {
fontSize: '12px',
color: 'var(--text-muted)',
whiteSpace: 'nowrap',
userSelect: 'none',
};
return (
<div style={containerStyle}>
<ChatBarButton
tooltip={isLoading ? "Loading..." : "Load More Messages & Sort by Reactions"}
onClick={handleLoadAndSortClick}
disabled={isLoading}
>
<svg width="20" height="20" viewBox="0 0 24 24" fill="currentColor" style={{ transform: "scale(1.1)" }}>
{isLoading ? (
<>
<path d="M12,1A11,11,0,1,0,23,12,11,11,0,0,0,12,1Zm0,19a8,8,0,1,1,8-8A8,8,0,0,1,12,20Z" opacity=".25"/>
<path d={`M10.72,19.9a8,8,0,0,1-6.5-9.79A7.77,7.77,0,0,1,10.4,4.16a8,8,0,0,1,9.49,6.52A1.54,1.54,0,0,0,21.38,12h.13a1.37,1.37,0,0,0,1.38-1.54,11,11,0,1,0-12.7,12.1A1.52,1.52,0,0,0,12,21.34h0A1.47,1.47,0,0,0,10.72,19.9Z`}>
<animateTransform attributeName="transform" type="rotate" dur="0.75s" values="0 12 12;360 12 12" repeatCount="indefinite"/>
</path>
</>
) : (
<>
<path d="M4.75 8.75a.75.75 0 0 1 .75-.75h13a.75.75 0 0 1 0 1.5h-13a.75.75 0 0 1-.75-.75Zm0 4a.75.75 0 0 1 .75-.75h7.5a.75.75 0 0 1 0 1.5h-7.5a.75.75 0 0 1-.75-.75Zm4 4a.75.75 0 0 1 .75-.75h3.5a.75.75 0 0 1 0 1.5h-3.5a.75.75 0 0 1-.75-.75Z"/>
<path d="M17 12.75a.75.75 0 0 1 .75.75v6a.75.75 0 0 1-1.5 0v-6a.75.75 0 0 1 .75-.75Zm1.78 7.28a.75.75 0 0 1 0 1.06l-2.25 2.25a.75.75 0 0 1-1.06 0l-2.25-2.25a.75.75 0 1 1 1.06-1.06l1.72 1.72 1.72-1.72a.75.75 0 0 1 1.06 0Z"/>
</>
)}
</svg>
</ChatBarButton>
{oldestMessageTimestampText && (
<span style={timestampStyle}>
Oldest: {oldestMessageTimestampText}
</span>
)}
</div>
);
};
export default definePlugin({
name: "SortByReactions",
description: "Adds a button to the message bar. If you click it, it will load 100 more messages (Discord API limit) and sort them by reaction count. Pressing the button multiple times, will load more messages. It further displays how far back messages are loaded.",
authors: [Devs.bvoq],
renderChatBarButton: LoadAndSortButton,
});
Vim shouldn't crash and highlight the tsx file properly.
9.1.754
Operating system: macOS
Terminal: iTerm2
Value of $TERM: xterm-256color
Shell: zsh
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
It's not actually crashing, you just lost syntax highlighting, right? Can you reproduce using vim --clean ?
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
Oh and please also check :h :syn-sync
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
It doesn't crash but it freezes completely.
If I run it with vim --clean I can't replicate the freezing (even though the .vimrc is empty).
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
Then you need to find out what in your .vimrc is causing this
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
Both my .vim and .vimrc are empty?
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
This is the logs.
chdir(/usr/share/vim) fchdir() to previous dir sourcing "$VIM/vimrc" finished sourcing $VIM/vimrc chdir(/usr/share/vim/vim91) fchdir() to previous dir could not source "$VIMRUNTIME/macmap.vim" chdir(/Users/deke) fchdir() to previous dir could not source "$HOME/.vimrc" chdir(/Users/deke/.vim) fchdir() to previous dir could not source "~/.vim/vimrc" chdir(/Users/deke/.config/vim) fchdir() to previous dir could not source "~/.config/vim/vimrc" chdir(/Users/deke) fchdir() to previous dir could not source "$HOME/.exrc" chdir(/usr/share/vim/vim91) fchdir() to previous dir sourcing "$VIMRUNTIME/defaults.vim" finished sourcing $VIMRUNTIME/defaults.vim not found in 'packpath': "pack/*/start/*" chdir(/usr/share/vim/vim91/plugin) fchdir() to previous dir sourcing "/usr/share/vim/vim91/plugin/getscriptPlugin.vim" finished sourcing /usr/share/vim/vim91/plugin/getscriptPlugin.vim chdir(/usr/share/vim/vim91/plugin) fchdir() to previous dir sourcing "/usr/share/vim/vim91/plugin/gzip.vim" finished sourcing /usr/share/vim/vim91/plugin/gzip.vim chdir(/usr/share/vim/vim91/plugin) fchdir() to previous dir sourcing "/usr/share/vim/vim91/plugin/logiPat.vim" finished sourcing /usr/share/vim/vim91/plugin/logiPat.vim chdir(/usr/share/vim/vim91/plugin) fchdir() to previous dir sourcing "/usr/share/vim/vim91/plugin/manpager.vim" finished sourcing /usr/share/vim/vim91/plugin/manpager.vim chdir(/usr/share/vim/vim91/plugin) fchdir() to previous dir sourcing "/usr/share/vim/vim91/plugin/matchparen.vim" finished sourcing /usr/share/vim/vim91/plugin/matchparen.vim chdir(/usr/share/vim/vim91/plugin) fchdir() to previous dir sourcing "/usr/share/vim/vim91/plugin/netrwPlugin.vim" finished sourcing /usr/share/vim/vim91/plugin/netrwPlugin.vim chdir(/usr/share/vim/vim91/plugin) fchdir() to previous dir sourcing "/usr/share/vim/vim91/plugin/rrhelper.vim" finished sourcing /usr/share/vim/vim91/plugin/rrhelper.vim chdir(/usr/share/vim/vim91/plugin) fchdir() to previous dir sourcing "/usr/share/vim/vim91/plugin/spellfile.vim" finished sourcing /usr/share/vim/vim91/plugin/spellfile.vim chdir(/usr/share/vim/vim91/plugin) fchdir() to previous dir sourcing "/usr/share/vim/vim91/plugin/tarPlugin.vim" finished sourcing /usr/share/vim/vim91/plugin/tarPlugin.vim chdir(/usr/share/vim/vim91/plugin) fchdir() to previous dir sourcing "/usr/share/vim/vim91/plugin/tohtml.vim" finished sourcing /usr/share/vim/vim91/plugin/tohtml.vim chdir(/usr/share/vim/vim91/plugin) fchdir() to previous dir sourcing "/usr/share/vim/vim91/plugin/vimballPlugin.vim" finished sourcing /usr/share/vim/vim91/plugin/vimballPlugin.vim chdir(/usr/share/vim/vim91/plugin) fchdir() to previous dir sourcing "/usr/share/vim/vim91/plugin/zipPlugin.vim" finished sourcing /usr/share/vim/vim91/plugin/zipPlugin.vim not found in 'packpath': "pack/*/start/*" not found in 'runtimepath': "plugin/**/*.vim" Reading viminfo file "/Users/deke/.viminfo" info oldfiles "index.tsx" "index.tsx" 154L, 6015B Reading viminfo file "/Users/deke/.viminfo" marks Executing BufWinEnter Autocommands for "*" autocommand autocmd SafeState * ++once call s:Highlight_Matching_Pair() Executing BufEnter Autocommands for "*" autocommand sil call s:LocalBrowse(expand("<amatch>")) Executing VimEnter Autocommands for "*" autocommand sil call s:VimEnter(expand("<amatch>")) Executing CursorMoved Autocommands for "*" autocommand call s:Highlight_Matching_Pair() Executing SafeState Autocommands for "*" autocommand call s:Highlight_Matching_Pair() chdir(/usr/share/vim/vim91/syntax) fchdir() to previous dir sourcing "/usr/share/vim/vim91/syntax/syntax.vim" chdir(/usr/share/vim/vim91/syntax) fchdir() to previous dir line 20: sourcing "/usr/share/vim/vim91/syntax/synload.vim" chdir(/usr/share/vim/vim91/syntax) fchdir() to previous dir line 22: sourcing "/usr/share/vim/vim91/syntax/syncolor.vim" chdir(/usr/share/vim/vim91/colors/lists) fchdir() to previous dir line 37: sourcing "/usr/share/vim/vim91/colors/lists/default.vim" finished sourcing /usr/share/vim/vim91/colors/lists/default.vim continuing in /usr/share/vim/vim91/syntax/syncolor.vim finished sourcing /usr/share/vim/vim91/syntax/syncolor.vim continuing in /usr/share/vim/vim91/syntax/synload.vim finished sourcing /usr/share/vim/vim91/syntax/synload.vim continuing in /usr/share/vim/vim91/syntax/syntax.vim chdir(/usr/share/vim/vim91) fchdir() to previous dir line 26: sourcing "/usr/share/vim/vim91/filetype.vim" not found in 'runtimepath': "ftdetect/*.vim" finished sourcing /usr/share/vim/vim91/filetype.vim continuing in /usr/share/vim/vim91/syntax/syntax.vim Executing FileType Autocommands for "*" autocommand 0verbose exe "set syntax=" . expand("<amatch>") Executing BufRead Autocommands for "*.tsx" autocommand setf typescriptreact Executing FileType Autocommands for "*" autocommand 0verbose exe "set syntax=" . expand("<amatch>") Executing BufRead Autocommands for "*" autocommand if !did_filetype() && expand("<amatch>") !~ g:ft_ignore_pat | runtime! scripts.vim | endif Executing BufRead Autocommands for "*" autocommand if !did_filetype() && expand("<amatch>") !~ g:ft_ignore_pat && (expand("<amatch>") =~# '\.conf$'^I|| getline(1) =~ '^#' || getline(2) =~ '^#'^I|| getline(3) =~ '^#' || getline(4) =~ '^#'^I|| getline(5) =~ '^#') | setf FALLBACK conf | endif finished sourcing /usr/share/vim/vim91/syntax/syntax.vim 'redrawtime' exceeded, syntax highlighting disabled Executing CursorMoved Autocommands for "*" autocommand call s:Highlight_Matching_Pair() Executing CursorMoved Autocommands for "*" autocommand call s:Highlight_Matching_Pair() Executing CursorMoved Autocommands for "*" autocommand call s:Highlight_Matching_Pair() Executing WinScrolled Autocommands for "*" autocommand call s:Highlight_Matching_Pair() Executing CursorMoved Autocommands for "*" autocommand call s:Highlight_Matching_Pair() Executing WinScrolled Autocommands for "*" autocommand call s:Highlight_Matching_Pair() Executing CursorMoved Autocommands for "*" autocommand call s:Highlight_Matching_Pair() Executing WinScrolled Autocommands for "*" autocommand call s:Highlight_Matching_Pair() Executing CursorMoved Autocommands for "*" autocommand call s:Highlight_Matching_Pair() Executing WinScrolled Autocommands for "*" autocommand call s:Highlight_Matching_Pair() Executing CursorMoved Autocommands for "*" autocommand call s:Highlight_Matching_Pair() Executing WinScrolled Autocommands for "*" autocommand call s:Highlight_Matching_Pair() Executing CursorMoved Autocommands for "*" autocommand call s:Highlight_Matching_Pair() Executing WinScrolled Autocommands for "*" autocommand call s:Highlight_Matching_Pair() Executing CursorMoved Autocommands for "*" autocommand call s:Highlight_Matching_Pair() Executing WinScrolled Autocommands for "*" autocommand call s:Highlight_Matching_Pair() Executing CursorMoved Autocommands for "*" autocommand call s:Highlight_Matching_Pair() Executing WinScrolled Autocommands for "*" autocommand call s:Highlight_Matching_Pair() Executing CursorMoved Autocommands for "*" autocommand call s:Highlight_Matching_Pair() Executing WinScrolled Autocommands for "*" autocommand call s:Highlight_Matching_Pair() Executing CursorMoved Autocommands for "*" autocommand call s:Highlight_Matching_Pair() Executing WinScrolled Autocommands for "*" autocommand call s:Highlight_Matching_Pair() Executing CursorMoved Autocommands for "*" autocommand call s:Highlight_Matching_Pair() Executing WinScrolled Autocommands for "*" autocommand call s:Highlight_Matching_Pair() Executing CursorMoved Autocommands for "*" autocommand call s:Highlight_Matching_Pair() Executing WinScrolled Autocommands for "*" autocommand call s:Highlight_Matching_Pair() Executing CursorMoved Autocommands for "*" autocommand call s:Highlight_Matching_Pair() Executing WinScrolled Autocommands for "*" autocommand call s:Highlight_Matching_Pair() Executing CursorMoved Autocommands for "*" autocommand call s:Highlight_Matching_Pair() Executing WinScrolled Autocommands for "*" autocommand call s:Highlight_Matching_Pair() Executing CursorMoved Autocommands for "*" autocommand call s:Highlight_Matching_Pair() Executing WinScrolled Autocommands for "*" autocommand call s:Highlight_Matching_Pair() Executing CursorMoved Autocommands for "*" autocommand call s:Highlight_Matching_Pair() Executing WinScrolled Autocommands for "*" autocommand call s:Highlight_Matching_Pair() Executing CursorMoved Autocommands for "*" autocommand call s:Highlight_Matching_Pair() Executing WinScrolled Autocommands for "*" autocommand call s:Highlight_Matching_Pair() Executing CursorMoved Autocommands for "*" autocommand call s:Highlight_Matching_Pair() Executing WinScrolled Autocommands for "*" autocommand call s:Highlight_Matching_Pair() Executing CursorMoved Autocommands for "*" autocommand call s:Highlight_Matching_Pair() Executing WinScrolled Autocommands for "*" autocommand call s:Highlight_Matching_Pair() Executing CursorMoved Autocommands for "*" autocommand call s:Highlight_Matching_Pair() Executing WinScrolled Autocommands for "*" autocommand call s:Highlight_Matching_Pair() Executing CursorMoved Autocommands for "*" autocommand call s:Highlight_Matching_Pair() Executing WinScrolled Autocommands for "*" autocommand call s:Highlight_Matching_Pair() Executing CursorMoved Autocommands for "*" autocommand call s:Highlight_Matching_Pair() Executing WinScrolled Autocommands for "*" autocommand call s:Highlight_Matching_Pair() Executing CursorMoved Autocommands for "*" autocommand call s:Highlight_Matching_Pair() Executing WinScrolled Autocommands for "*" autocommand call s:Highlight_Matching_Pair() Executing CursorMoved Autocommands for "*" autocommand call s:Highlight_Matching_Pair() Executing WinScrolled Autocommands for "*" autocommand call s:Highlight_Matching_Pair() Executing CursorMoved Autocommands for "*" autocommand call s:Highlight_Matching_Pair() Executing WinScrolled Autocommands for "*" autocommand call s:Highlight_Matching_Pair() Executing CursorMoved Autocommands for "*" autocommand call s:Highlight_Matching_Pair() Executing WinScrolled Autocommands for "*" autocommand call s:Highlight_Matching_Pair() Executing CursorMoved Autocommands for "*" autocommand call s:Highlight_Matching_Pair() Executing WinScrolled Autocommands for "*" autocommand call s:Highlight_Matching_Pair() Executing CursorMoved Autocommands for "*" autocommand call s:Highlight_Matching_Pair() Executing WinScrolled Autocommands for "*" autocommand call s:Highlight_Matching_Pair() Executing CursorMoved Autocommands for "*" autocommand call s:Highlight_Matching_Pair() Executing WinScrolled Autocommands for "*" autocommand call s:Highlight_Matching_Pair() Executing CursorMoved Autocommands for "*" autocommand call s:Highlight_Matching_Pair() Executing WinScrolled Autocommands for "*" autocommand call s:Highlight_Matching_Pair() Executing CursorMoved Autocommands for "*" autocommand call s:Highlight_Matching_Pair() Executing WinScrolled Autocommands for "*" autocommand call s:Highlight_Matching_Pair() Executing CursorMoved Autocommands for "*" autocommand call s:Highlight_Matching_Pair() Executing WinScrolled Autocommands for "*" autocommand call s:Highlight_Matching_Pair() Executing CursorMoved Autocommands for "*" autocommand call s:Highlight_Matching_Pair() Executing WinScrolled Autocommands for "*" autocommand call s:Highlight_Matching_Pair() Executing CursorMoved Autocommands for "*" autocommand call s:Highlight_Matching_Pair() Executing WinScrolled Autocommands for "*" autocommand call s:Highlight_Matching_Pair() Executing CursorMoved Autocommands for "*" autocommand call s:Highlight_Matching_Pair() Executing WinScrolled Autocommands for "*" autocommand call s:Highlight_Matching_Pair() Executing CursorMoved Autocommands for "*" autocommand call s:Highlight_Matching_Pair() Executing WinScrolled Autocommands for "*" autocommand call s:Highlight_Matching_Pair() Executing CursorMoved Autocommands for "*" autocommand call s:Highlight_Matching_Pair() Executing WinScrolled Autocommands for "*" autocommand call s:Highlight_Matching_Pair() Executing CursorMoved Autocommands for "*" autocommand call s:Highlight_Matching_Pair() Executing WinScrolled Autocommands for "*" autocommand call s:Highlight_Matching_Pair() Executing CursorMoved Autocommands for "*" autocommand call s:Highlight_Matching_Pair() Executing WinScrolled Autocommands for "*" autocommand call s:Highlight_Matching_Pair() Executing CursorMoved Autocommands for "*" autocommand call s:Highlight_Matching_Pair() Executing WinScrolled Autocommands for "*" autocommand call s:Highlight_Matching_Pair() Executing CursorMoved Autocommands for "*" autocommand call s:Highlight_Matching_Pair() Executing WinScrolled Autocommands for "*" autocommand call s:Highlight_Matching_Pair() Executing CursorMoved Autocommands for "*" autocommand call s:Highlight_Matching_Pair() Executing CursorMoved Autocommands for "*" autocommand call s:Highlight_Matching_Pair() Executing CursorMoved Autocommands for "*" autocommand call s:Highlight_Matching_Pair() Executing WinScrolled Autocommands for "*" autocommand call s:Highlight_Matching_Pair() Executing CursorMoved Autocommands for "*" autocommand call s:Highlight_Matching_Pair() Executing WinScrolled Autocommands for "*" autocommand call s:Highlight_Matching_Pair() Executing CursorMoved Autocommands for "*" autocommand call s:Highlight_Matching_Pair() Executing WinScrolled Autocommands for "*" autocommand call s:Highlight_Matching_Pair() Executing CursorMoved Autocommands for "*" autocommand call s:Highlight_Matching_Pair() Executing WinScrolled Autocommands for "*" autocommand call s:Highlight_Matching_Pair() Executing CursorMoved Autocommands for "*" autocommand call s:Highlight_Matching_Pair() Executing WinScrolled Autocommands for "*" autocommand call s:Highlight_Matching_Pair() Executing CursorMoved Autocommands for "*" autocommand call s:Highlight_Matching_Pair() Executing WinScrolled Autocommands for "*" autocommand call s:Highlight_Matching_Pair() Executing CursorMoved Autocommands for "*" autocommand call s:Highlight_Matching_Pair() Executing WinScrolled Autocommands for "*" autocommand call s:Highlight_Matching_Pair() Executing CursorMoved Autocommands for "*" autocommand call s:Highlight_Matching_Pair() Executing WinScrolled Autocommands for "*" autocommand call s:Highlight_Matching_Pair() Executing CursorMoved Autocommands for "*" autocommand call s:Highlight_Matching_Pair() Executing WinScrolled Autocommands for "*" autocommand call s:Highlight_Matching_Pair() Executing CursorMoved Autocommands for "*" autocommand call s:Highlight_Matching_Pair() Executing WinScrolled Autocommands for "*" autocommand call s:Highlight_Matching_Pair() Executing CursorMoved Autocommands for "*" autocommand call s:Highlight_Matching_Pair() Executing WinScrolled Autocommands for "*" autocommand call s:Highlight_Matching_Pair() Executing CursorMoved Autocommands for "*" autocommand call s:Highlight_Matching_Pair() Executing CursorMoved Autocommands for "*" autocommand call s:Highlight_Matching_Pair() Executing WinScrolled Autocommands for "*" autocommand call s:Highlight_Matching_Pair() Executing CursorMoved Autocommands for "*" autocommand call s:Highlight_Matching_Pair() Executing WinScrolled Autocommands for "*" autocommand call s:Highlight_Matching_Pair() Executing CursorMoved Autocommands for "*" autocommand call s:Highlight_Matching_Pair() Executing WinScrolled Autocommands for "*" autocommand call s:Highlight_Matching_Pair() Executing CursorMoved Autocommands for "*" autocommand call s:Highlight_Matching_Pair() Executing WinScrolled Autocommands for "*" autocommand call s:Highlight_Matching_Pair() Executing CursorMoved Autocommands for "*" autocommand call s:Highlight_Matching_Pair() Type :qa and press <Enter> to exit Vim Type :qa and press <Enter> to exit Vim Executing CursorMoved Autocommands for "*" autocommand call s:Highlight_Matching_Pair() Executing CursorMoved Autocommands for "*" autocommand call s:Highlight_Matching_Pair() Executing CursorMoved Autocommands for "*" autocommand call s:Highlight_Matching_Pair() Executing CursorMoved Autocommands for "*" autocommand call s:Highlight_Matching_Pair()
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
if your .vimrc is empty, it could still be any plugin you installed.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
I used AI which also creates .tsx files, and to edit them I move these files to .txt edit them, then rename it back to tsx.
I use iTerm2 on MacOSX 14.8.3
When running with vim --clean the file starts with syntax highlight on - then I scroll down until it gets stuck, vim disables the syntax highlighting (black & white only) and I can continue to scrolldown, when I scroll up again - the part that was highlighted is also B&W now ... and I can scroll down & up freely.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
Can confirm the same, other users have also seen this:
Strangest vim bug ever seems typescript specific, freezes when I try to open this file:
https://lnkd.in/e7dySXMm
Use Hugging Face with JavaScript. Contribute to huggingface/huggingface.js development by creating an account on GitHub.
huggingface.js/packages/tasks/src/local-apps.ts at main · huggingface/huggingface.js
github.com
like
1
4 comments
Reactions
View Suraj Variar’s graphic link
like
Like
Comment
Repost
Send
371 impressions
View analytics
Eric Curtin
Add a comment…
Open Emoji Keyboard
Current selected sort order is Most relevant
Most relevant
View Eric Curtin’s graphic link
Eric Curtin
Author
Principal Software Engineer working on AI at Docker, Inc
3h
That being said, easy temporary fix:
syntax off
Like
Reply
138 impressions
View Ryan Petrello’s graphic link
Ryan Petrello
• 1st
Principal Software Engineer
(edited)
32m
I had the same issue with my setup, adding this to my .vimrc helped:
set regexpengine=0
It seems related to vim's legacy regex engine for syntax highlighting being very slow for Typescript.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
I had a quick look but I can't seem to reproduce it.
These reports should go through the upstream repo https://github.com/HerringtonDarkholme/yats.vim/.
HerringtonDarkholme/yats.vim#292 has been closed so perhaps it has been fixed, though it's not obvious from the issue.
Please report your findings here.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
Also, if you believe this is related to syntax highlighting, can you please follow this guide here: :h syntime and report the syntime for your file?
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
For others facing this issue:
Adding set regexpengine=2 to your .vimrc will resolve the problem.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!
You are receiving this because you are subscribed to this thread.![]()
Can someone try this?
diff --git a/runtime/syntax/shared/typescriptcommon.vim b/runtime/syntax/shared/typescriptcommon.vim index 1cb1740f8..29535a145 100644 --- a/runtime/syntax/shared/typescriptcommon.vim +++ b/runtime/syntax/shared/typescriptcommon.vim @@ -1948,12 +1948,12 @@ syntax match typescriptArrowFuncDef contained /\K\k*\s*=>/ \ nextgroup=@typescriptExpression,typescriptBlock \ skipwhite skipempty -syntax match typescriptArrowFuncDef contained /(\%(\_[^()]\+\|(\_[^()]*)\)*)\_s*=>/ +syntax match typescriptArrowFuncDef contained /(\_[^()]*\%((\_[^()]*)\_[^()]*\)*)\_s*=>/ \ contains=typescriptArrowFuncArg,typescriptArrowFunc,@typescriptCallSignature \ nextgroup=@typescriptExpression,typescriptBlock \ skipwhite skipempty -syntax region typescriptArrowFuncDef contained start=/(\%(\_[^()]\+\|(\_[^()]*)\)*):/ matchgroup=typescriptArrowFunc end=/=>/ +syntax region typescriptArrowFuncDef contained start=/(\_[^()]*\%((\_[^()]*)\_[^()]*\)*):/ matchgroup=typescriptArrowFunc end=/=>/ \ contains=typescriptArrowFuncArg,typescriptTypeAnnotation,@typescriptCallSignature \ nextgroup=@typescriptExpression,typescriptBlock \ skipwhite skipempty keepend
—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!
You are receiving this because you are subscribed to this thread.![]()
ran into this myself as well. @dkearns thanks for taking on, your fix looks great!
why:
runtime/syntax/shared/typescriptcommon.vim:1951 the typescriptArrowFuncDef causes a regex heavy regex backtrackworkaround (not 2 as suggested a couple comments above):
set regexpengine=0
hopefully Apple should change to the default if possible as well!
—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!
You are receiving this because you are subscribed to this thread.![]()
I overwrote ~/.vim/syntax/shared/typescriptcommon.vim with your patch and can confirm that it is working @dkearns
—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!
You are receiving this because you are subscribed to this thread.![]()