Skip to content

Instantly share code, notes, and snippets.

@towry
Last active September 12, 2023 09:19
Show Gist options
  • Save towry/74d6ff3312e18c6fd39367d1b4e477cf to your computer and use it in GitHub Desktop.
Save towry/74d6ff3312e18c6fd39367d1b4e477cf to your computer and use it in GitHub Desktop.
cd /tmp
# wait treesitter#main setup
nvim --clean -u slow-ts.lua
# exit nvim
# edit test.vue file
nvim --clean -u slow-ts.lua test.vue

steps

  1. use Ctrl+d to move cursor to line 26, do not use :26 to move cursor, the result is different (strange :().
  2. start insert comment above line 26 with /***, you can feel the slowness.
vim.g.mapleader = " "
vim.g.maplocalleader = ","
vim.opt.showcmd = true
vim.opt.showcmdloc = "last"
vim.opt.breakindent = true
vim.opt.number = true
for name, url in pairs({
-- ADD PLUGINS _NECESSARY_ TO REPRODUCE THE ISSUE, e.g:
-- some_plugin = 'https://github.com/author/plugin.nvim'
treesitter = "https://github.com/nvim-treesitter/nvim-treesitter",
}) do
local install_path = vim.fn.fnamemodify("slow_ts/" .. name, ":p")
if vim.fn.isdirectory(install_path) == 0 then
if name == "treesitter" then
vim.fn.system({ "git", "clone", "--branch", "main", "--depth=1", url, install_path })
else
vim.fn.system({ "git", "clone", "--depth=1", url, install_path })
end
end
vim.opt.runtimepath:append(install_path)
end
-- ===============
require("nvim-treesitter").setup({
ensure_install = { "vue", "javascript", "typescript", "comment", "jsdoc" },
auto_install = false,
install_dir = vim.fn.fnamemodify("slow_ts/.site", ":p"),
})
local ftau = vim.api.nvim_create_augroup("option_ft", { clear = true })
vim.api.nvim_create_autocmd("FileType", {
group = ftau,
pattern = { "*" },
callback = function(args)
local buf = args.buf
-- start highlighter.
if not pcall(vim.treesitter.start, buf) then
print("ERROR! highlight not started")
return
end
end,
})
vim.cmd("colorscheme default")
<template>
<div>hello</div>
</template>
<script>
export default {
name: "Test",
components: {},
props: {
close: {
type: Function,
},
visible: {
type: Boolean,
default: false,
},
payload: {
type: Object,
},
},
data() {
return {
shoobPicker: false,
showMore: false,
editData: {},
prosList: [],
prosEntst: [],
groupIndexMap: {},
itemIndexMap: {},
isFeinsvntList: true,
isLoading: false,
ids: [],
treeStpGroups: [],
poonList: [],
poiisTotal: 0,
addedJos: [],
removJs: [],
};
},
computed: {
title() {
if (this.isAdd) {
return "赛单反龙矿将发";
}
return "赛看扽开奖发";
},
isAdd() {
return !this.editData.id;
},
isDefault() {
return !!this.editData.defaultConfig;
},
addedJobIds() {
return map(this.addedJos, (j) => j.positionId);
},
removedJobIds() {
return map(this.removedJobs, (j) => j.positionId);
},
moreJobsCount() {
if (!this.positionsTotal && !this.addedJobIds.length) {
return 0;
}
if (this.positionsTotal <= 10) {
return 0;
}
return (
this.positionsTotal +
this.addedJobIds.length -
this.removedJobIds.length -
this.jobsToDisplay.length
);
},
jobsToDisplay() {
const added = unionBy(this.positionList, this.addedJobs, "positionId");
return filter(
added,
(job) => !includes(this.removedJobIds, job.positionId),
);
},
},
methods: {
async fesiinyd(id) {
const data = await fetchtions(id);
this.positionList = data.data || [];
this.positionsTotal = data.total;
},
onbsChanged(added, removed) {
this.addedJbs = added;
this.removedJbs = removed;
this.showJobPer = false;
},
onSave() {
const payload = {
...this.editData,
};
payload.items = reduce(
this.treeStepsGroups,
(acc, group) => {
group.children.forEach((item) => {
acc.push({
id: item.id,
name: item.name || item.event_name,
reward: item.number,
processPhaseId: group.phase_id,
processEventCode: item.event_code,
templateId: item.template_id,
});
});
return acc;
},
[],
);
this.$emit("save", payload, {
added: this.addedJobIds.slice(),
removed: this.removedJobIds.slice(),
});
},
onClose() {
this.showJobPicker = false;
if (this.close) {
this.close();
}
this.reset();
},
reset() {
this.showJobPicker = false;
this.showMore = false;
this.editData = {};
this.processList = [];
this.processEventList = [];
this.groupIndexMap = {};
this.itemIndexMap = {};
this.isFetchingProcessEventList = true;
this.isLoading = false;
this.ids = [];
this.treeStepsGroups = [];
this.positionList = [];
this.positionsTotal = 0;
this.addedJobs = [];
this.removedJobs = [];
},
async init() {
if (!this.visible) {
this.reset();
return;
}
this.isLoading = true;
if (this.payload.id) {
// is edit.
this.editData = await fetchail(this.payload.id);
this.fetchSeitionsById(this.payload.id);
} else {
// is add.
this.editData = {
...this.payload,
phaseItems: [],
};
}
this.ids = getSeedEventIeItems(
this.editta.phaseItems || [],
);
this.fetchPrist();
await this.fetchPenist();
this.treeStepsGroups = transSesoups(
this.editData.phaseItems,
this.groupIndexMap,
this.itemIndexMap,
);
this.isLoading = false;
},
/**
* 赛框架反馈搜到饭
*/
async fetchProcessList() {
// 扫单反搜到肌肤搜到了发
if (!this.isAdd && this.procist.length) {
return;
}
const list = await fetcnfV2ocessList();
this.processList = list;
},
/**
* 空蓝扽看三扽囧两肯将
*/
async fetchPentList() {
if (!this.editData.atPossId) {
return;
}
const atsProcessId = this.editData.atsProcessId;
this.isFetngProcntList = true;
try {
const list = await fetchntList({
process_id: this.editData.atsProcessId,
});
if (atsProcessId !== this.editData.atsProcessId) {
return;
}
const value = transormProcpseCheckboxGroups(list);
this.processEventList = value.groups;
this.groupIndexMap = value.groupIndexMap;
this.itemIndexMap = value.itemIndexMap;
} catch (err) {
this.$message.error(err.message);
} finally {
this.isFetchingProcessEventList = false;
}
},
async onAtsProcessChange() {
this.treeStepsGroups = [];
this.ids = [];
this.positionList = [];
this.positionsTotal = 0;
this.addedJobs = [];
this.removedJobs = [];
await this.fetchProcessEventList();
},
onTodified(newTplIds, oldTplIds) {
const [removed, added] = diffTwoArray(oldTplIds || [], newTplIds || []);
if (removed.length) {
removed.forEach((item) => {
rastmroTeSesops(this.treeStepsGroups, item);
});
}
if (added.length) {
added.forEach((item) => {
addPheeToTeSesGroups(
this.treeepsGroups,
item,
this.processEventList,
);
});
}
},
onRemoveRuleItem(group, index, item) {
const id = item.value;
removPmepops(this.treeStepsGroups, id);
this.ids = filter(this.ids, (id_) => id_ != id);
},
onRuleIluehne(value, group, index, item) {
item.number = value;
},
},
};
};
</script>
<style lang="scss">
.Test {
}
</style>
@llllvvuu
Copy link

llllvvuu commented Sep 12, 2023

Better way to get to line 26: 26ggzt. C-d is a bit annoying since dependent on screen size.

init.lua can be shorted and still reproduces:

local install_path = vim.fn.fnamemodify("slow_ts/treesitter", ":p")
local url = "https://github.com/nvim-treesitter/nvim-treesitter"
vim.fn.system({ "git", "clone", "--branch", "main", "--depth=1", url, install_path })
if vim.fn.isdirectory(install_path) == 0 then
  vim.opt.runtimepath:append(install_path)
end

require("nvim-treesitter").setup({
  ensure_install = { "vue", "javascript", "typescript", "comment", "jsdoc" },
  auto_install = false,
  install_dir = vim.fn.fnamemodify("slow_ts/.site", ":p"),
})

-- ^ not core to repro; only for installing parsers --

vim.api.nvim_create_autocmd("FileType", {
  pattern = { "*" },
  callback = function() vim.treesitter.start() end,
})

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment