Comments (5)
Re-indenting 419 lines now gave me
FUNCTION vlime#ui#CurArgPos()
Defined: .../vlime/vim/autoload/vlime/ui.vim:1102
Called 1145 times
Total time: 48.109187
Self time: 48.109187
...
591677 28.625727 let syntax = map(synstack(ln, idx), 'synIDattr(v:val, "name")')
Perhaps a simple per-buffer cache that stores the indentation for each line (or form?) so we don't do O(nĀ²)
runs here?
FUNCTIONS SORTED ON TOTAL TIME
count total (s) self (s) function
399 54.321642 0.074243 vlime#plugin#CalcCurIndent()
399 54.027148 0.307812 vlime#ui#ParseOuterOperators()
1145 48.109187 vlime#ui#CurArgPos()
1145 5.610149 0.124386 vlime#ui#CurOperator()
1456 5.579339 0.064519 vlime#ui#CurExpr()
2912 5.461276 vlime#ui#CurExprPos()
311 0.174020 0.003437 vlime#GetCurrentPackage()
311 0.170583 0.008193 vlime#ui#GetCurrentPackage()
from vlime.
Notes:
b:changedtick
for cache invalidation- replace loops by a
searchpairpos('(','',')','nrb', CB)
with a suitable callback function that stores the start/end positions of all the parens in the file in a dict (referencing the parent parens as well) - In the actual
CurArgPos()
just look at the paren tree and go word-wise backward (B
in normal mode), skipping comments
PS: Just found the lua-treesitter
reference in the nvim docs... perhaps that might be a future direction. (got https://github.com/nvim-treesitter/nvim-treesitter-refactor resp. https://github.com/nvim-treesitter/playground as links)
from vlime.
Yes, a Lisp parser would be really cool. There is one for clojure that could be adapted for Lisp: https://github.com/sogaiu/tree-sitter-clojure. I always wanted to implement it but never found the time to write the grammar rules and the queries.
Tree-sitter-based paredit is also very cool. It also works for non-lisp languages if the parser gives a sufficiently structure syntax tree.
from vlime.
Well, treesitter is nvim
-only right now, so we'd lose quite a lot of compatibility (and users?).
I guess the caching version to fix the perf issue would be the right way, right now.
from vlime.
And it's only nvim nightly. This is why I was a bit surprised when you cited it. But it would be possible to use it for some functionality if it's available or just have it in nvim-treesitter for additional support for Lisp
from vlime.
Related Issues (20)
- Connecting to running Swank server? HOT 25
- Installation issues on MacOS with Pathogen HOT 3
- Implement the Parinfer algorithm HOT 2
- Request consideration to "rename" the project HOT 1
- How to get autocomplete? HOT 3
- Don't escape ANSI escape sequences
- `sldb` buffer doesn't work on OpenBSD HOT 7
- Weird highlight behavior inside the REPL buffer HOT 1
- SBCL warnings seem to break the REPL connection HOT 22
- can't press `d` to inspect frame in debugger HOT 4
- Interactively macro-expand a form HOT 2
- Rebind your leaders for weird outcome HOT 1
- Fix this bug introduced by upstream: thread waiting HOT 2
- Slynk support...? HOT 2
- Bug in commit cfaac6ccb379f9f85bfb2ef17ca6369dfadf2be6
- neovim swank:close-connection: end of file HOT 18
- Cusomtizing *print-case* Breaks Restarts HOT 11
- "Manual Install" Failing UI Test, Mappings default to slimv HOT 4
- Quote HOT 2
- Add a feature to load a system (similar to `M-x slime-load-system` in SLIME) HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
š Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ššš
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ā¤ļø Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vlime.