Don't let the cursor slow you down
Go to file
Josh Bleecher Snyder ae5304ddf3
implement non-quadratic version of uniqWith (#1834)
When given a comparator, uniqWith is quadratic.
Add uniqWithHash that uses an optional hash function
to return to approximately linear behavior,
assuming that the hash function is good.
For targets and selections,
Using the contentRange/selection as the hash value
seems to be pretty good in practice.

I've added "concise" printing versions of positions,
ranges, and selections. These are handy as hash functions,
but I've also made heavy use of them while investigating
hat allocation. They are generally useful.

"take every line" on a file containing 3000 lines
used to take about 15s on my computer.
Now it takes about 1s.
That's still not great but it's fast enough
that it doesn't appear that Cursorless has hung.

I've half a mind to try upstreaming this,
or at least sending a documentation fix,
because a quadratic API is a big footgun.

Fixes #1830 enough for now



## Checklist

- [x] I have added
[tests](https://www.cursorless.org/docs/contributing/test-case-recorder/)
- [/] I have updated the
[docs](https://github.com/cursorless-dev/cursorless/tree/main/docs) and
[cheatsheet](https://github.com/cursorless-dev/cursorless/tree/main/cursorless-talon/src/cheatsheet)
- [/] I have not broken the cheatsheet

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
Co-authored-by: Pokey Rule <755842+pokey@users.noreply.github.com>
2023-09-01 14:17:58 +00:00
.github Added empty leading lines to pr template (#1575) 2023-07-07 15:40:00 +00:00
.meta-updater Migrate to a pnpm monorepo (#1281) 2023-03-21 13:28:05 +00:00
.vscode vscode: Recommend ruff extension (#1833) 2023-08-30 14:53:06 +00:00
cursorless-snippets Add Go support to snippets (#1591) 2023-07-07 08:09:44 +00:00
cursorless-talon doc "drink" and "pour" can do more than lines (#1772) 2023-08-27 18:32:18 +00:00
cursorless-talon-dev cursorless_command("replaceWithTarget") fix (#1813) 2023-08-20 13:50:45 +00:00
data/playground migrate Go func, func name, and lambda to treesitter (#1756) 2023-08-15 08:51:19 +00:00
docs Release 0.28.0 (#1818) 2023-09-01 13:53:24 +00:00
fonts Add a status bar item for cursorless (#881) 2022-08-03 17:15:41 +01:00
images Remove trailing new lines in svgs (#650) 2022-04-25 16:31:09 +01:00
packages implement non-quadratic version of uniqWith (#1834) 2023-09-01 14:17:58 +00:00
patches Migrate to a pnpm monorepo (#1281) 2023-03-21 13:28:05 +00:00
queries Add Cursorless support for tree-sitter query .scm files (#1448) 2023-08-22 12:46:29 +00:00
schemas Support specializing snippet definitions by containing scope (#1487) 2023-05-24 17:04:23 +00:00
scripts Bump memory requirement for docs site build (#1644) 2023-07-17 14:06:16 +00:00
typings Support tree-sitter query operators (#1446) 2023-05-05 15:41:22 +00:00
.editorconfig Migrate to a pnpm monorepo (#1281) 2023-03-21 13:28:05 +00:00
.eslintrc.json eslint: Use import/typescript config (#1696) 2023-07-30 14:32:44 +00:00
.git-blame-ignore-revs Update .git-blame-ignore-revs to exclude 4dc746c (#1198) 2022-12-22 10:02:23 +00:00
.gitignore move subset regular expressions to a separate file (#1690) 2023-08-14 13:52:43 +00:00
.npmrc Migrate to a pnpm monorepo (#1281) 2023-03-21 13:28:05 +00:00
.pre-commit-config.yaml Fix E2BIG error in pre-commit (#1712) 2023-08-01 12:26:30 +00:00
.prettierignore Added empty leading lines to pr template (#1575) 2023-07-07 15:40:00 +00:00
.prettierrc Switch to prettier trailingComma: "all" (#1084) 2022-10-24 16:08:53 +02:00
.syncpackrc.json Migrate to a pnpm monorepo (#1281) 2023-03-21 13:28:05 +00:00
CHANGELOG.md Change cursorless-dev/cursorless-vscode to cursorless-dev/cursorless (#656) 2022-04-26 13:56:23 +01:00
CONTRIBUTING.md Serve docs folder and API reference on GitHub pages (#477) 2022-03-16 23:23:03 +00:00
LICENSE Add license 2021-05-04 12:07:25 +01:00
netlify.toml Migrate to a pnpm monorepo (#1281) 2023-03-21 13:28:05 +00:00
NOTICE.md Clean up badges; add ratings badge (#488) 2022-01-17 14:06:49 +00:00
package.json deps: Upgrade @pnpm/meta-updater to 1.0.0 (#1791) 2023-08-15 11:05:45 +00:00
pnpm-lock.yaml implement non-quadratic version of uniqWith (#1834) 2023-09-01 14:17:58 +00:00
pnpm-workspace.yaml Migrate to a pnpm monorepo (#1281) 2023-03-21 13:28:05 +00:00
pyproject.toml Switch from shed to ruff (#1375) 2023-04-05 12:58:03 +00:00
README.md Remove useless version badge (#1224) 2023-01-19 14:07:07 +01:00
SECURITY.md Create SECURITY.md (#1184) 2022-12-15 18:44:28 +01:00
third-party-licenses.csv Create local extension sandbox (#691) 2022-05-25 19:46:15 +01:00
tsconfig.base.json tsconfig: Enable isolatedModules (#1829) 2023-09-01 13:05:15 +00:00
tsconfig.json Merge cursorless-vscode-core into cursorless-vscode (#1421) 2023-04-14 22:03:16 +00:00

Welcome to Cursorless!

Rating Documentation Tests Maintenance License: MIT

Cursorless is a spoken language for structural code editing, enabling developers to code by voice at speeds not possible with a keyboard. Cursorless decorates every token on the screen and defines a spoken language for rapid, high-level semantic manipulation of structured text.

Checkout the docs and videos to learn more. See installation for installation instructions.

And I heard you like GIFs?

Curly repack ox Move arg air and each to after drum Chuck tail red pipe slice past end of file

Installation

Currently depends on Talon, though a keyboard version is planned.

See installation for installation instructions.

Extension Settings

This extension contributes the following settings:

  • cursorless.showOnStart: Whether decorations should appear on workspace start
  • cursorless.hatSizeAdjustment: Percentage to increase or decrease hat size; positive increases size
  • cursorless.hatVerticalOffset: How much to vertically shift the hats as a percentage of font size; positive is up
  • cursorless.hatEnablement.colors: Whether to enable particular hat colors.
  • cursorless.hatEnablement.shapes: Whether to enable particular hat shapes.
  • cursorless.hatPenalties.colors: How much to penalize each hat color. You will probably want to set this one to the number of syllables in the given style. Cursorless will then sort every style combination by number of syllables to refer to it.
  • cursorless.hatPenalties.shapes: How much to penalize each hat shape. You will probably want to set this one to the number of syllables in the given style. Cursorless will then sort every style combination by number of syllables to refer to it.
  • cursorless.maximumHatStylePenalty: The maximum allowed penalty for a hat style. Any hat style whose penalty is greater than this amount will not be used. A hat style penalty is defined to be the shape penalty plus the colour penalty. Setting this value less than or equal to zero is treated as no maximum.

Known Issues

  • Cursorless calculates the position of the hats based on the characteristics of your font. If you find that the hats are off center you can try running this command: cursorless.recomputeDecorationStyles

Contributing

See contributing.

Change Log

See CHANGELOG.md.

Attributions

See NOTICE.md.