Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/common/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ export * from "./util/itertools";
export * from "./util/Notifier";
export * from "./util/object";
export * from "./util/omitByDeep";
export * from "./util/prettifyLanguageName";
export * from "./util/range";
export * from "./util/regex";
export * from "./util/selectionsEqual";
Expand Down
33 changes: 33 additions & 0 deletions packages/common/src/util/prettifyLanguageName.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { capitalize } from "./stringUtils";

export function prettifyLanguageName(name: string): string {
switch (name) {
case "cpp":
return "C++";
case "csharp":
return "C#";
case "javascript":
return "JavaScript";
case "typescript":
return "TypeScript";
case "javascriptreact":
return "JavaScript React";
case "typescriptreact":
return "TypeScript React";
case "jsonl":
return "JSON lines (JSONL)";
case "jsonc":
return "JSON with comments (JSONC)";
case "scm":
return "Tree sitter query (SCM)";
case "css":
case "scss":
case "json":
case "php":
case "html":
case "xml":
return name.toUpperCase();
default:
return capitalize(name);
}
}
8 changes: 8 additions & 0 deletions packages/common/src/util/serializeScopeType.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import { capitalize } from "lodash-es";
import type {
ScopeType,
ScopeTypeType,
SimpleScopeTypeType,
} from "../types/command/PartialTargetDescriptor.types";
import { camelCaseToAllDown } from "./stringUtils";

export function serializeScopeType(
scopeType: SimpleScopeTypeType | ScopeType,
Expand All @@ -12,3 +14,9 @@ export function serializeScopeType(
}
return scopeType.type;
}

export function prettifyScopeType(
scopeType: SimpleScopeTypeType | ScopeType,
): string {
return capitalize(camelCaseToAllDown(serializeScopeType(scopeType)));
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Scopes

All available scopes in Cursorless
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { Scopes } from "./components/Scopes";

# Anonymous function

<Scopes scopeTypeType="anonymousFunction" />
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { Scopes } from "./components/Scopes";

# Argument list

<Scopes scopeTypeType="argumentList" />
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { Scopes } from "./components/Scopes";

# Argument or parameter

<Scopes scopeTypeType="argumentOrParameter" />
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { Scopes } from "./components/Scopes";

# Attribute

<Scopes scopeTypeType="attribute" />
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
sidebar_label: Bounded non-ws sequence
---

import { Scopes } from "./components/Scopes";

# Bounded non-whitespace sequence

<Scopes scopeTypeType="boundedNonWhitespaceSequence" />
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { Scopes } from "./components/Scopes";

# Bounded paragraph

<Scopes scopeTypeType="boundedParagraph" />
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { Scopes } from "./components/Scopes";

# Branch

<Scopes scopeTypeType="branch" />
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { Scopes } from "./components/Scopes";

# Character

<Scopes scopeTypeType="character" />
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { Scopes } from "./components/Scopes";

# Class

<Scopes scopeTypeType="class" />
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { Scopes } from "./components/Scopes";

# Class name

<Scopes scopeTypeType="className" />
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { Scopes } from "./components/Scopes";

# Collection item

<Scopes scopeTypeType="collectionItem" />
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { Scopes } from "./components/Scopes";

# Collection key

<Scopes scopeTypeType="collectionKey" />
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { Scopes } from "./components/Scopes";

# Command

<Scopes scopeTypeType="command" />
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { Scopes } from "./components/Scopes";

# Comment

<Scopes scopeTypeType="comment" />
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import React from "react";

export function Scopes() {
return <div>Coming soon!</div>;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { Scopes } from "./components/Scopes";

# Condition

<Scopes scopeTypeType="condition" />
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { Scopes } from "./components/Scopes";

# Disqualify delimiter

<Scopes scopeTypeType="disqualifyDelimiter" />
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { Scopes } from "./components/Scopes";

# Document

<Scopes scopeTypeType="document" />
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { Scopes } from "./components/Scopes";

# Environment

<Scopes scopeTypeType="environment" />
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { Scopes } from "./components/Scopes";

# Field access

This scope is private for now and should not be used!

<Scopes scopeTypeType="private.fieldAccess" />
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { Scopes } from "./components/Scopes";

# Function call

<Scopes scopeTypeType="functionCall" />
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { Scopes } from "./components/Scopes";

# Function callee

<Scopes scopeTypeType="functionCallee" />
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { Scopes } from "./components/Scopes";

# Function name

<Scopes scopeTypeType="functionName" />
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { Scopes } from "./components/Scopes";

# Identifier

<Scopes scopeTypeType="identifier" />
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { Scopes } from "./components/Scopes";

# If statement

<Scopes scopeTypeType="ifStatement" />
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { Scopes } from "./components/Scopes";

# Interior

<Scopes scopeTypeType="interior" />
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { Scopes } from "./components/Scopes";

# Line

<Scopes scopeTypeType="line" />
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { Scopes } from "./components/Scopes";

# List

<Scopes scopeTypeType="list" />
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { Scopes } from "./components/Scopes";

# Map

<Scopes scopeTypeType="map" />
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { Scopes } from "./components/Scopes";

# Name

<Scopes scopeTypeType="name" />
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { Scopes } from "./components/Scopes";

# Named function

<Scopes scopeTypeType="namedFunction" />
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { Scopes } from "./components/Scopes";

# Non-whitespace sequence

<Scopes scopeTypeType="nonWhitespaceSequence" />
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { Scopes } from "./components/Scopes";

# Notebook cell

<Scopes scopeTypeType="notebookCell" />
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { Scopes } from "./components/Scopes";

# Pair delimiter

<Scopes scopeTypeType="pairDelimiter" />
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { Scopes } from "./components/Scopes";

# Paragraph

<Scopes scopeTypeType="paragraph" />
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { Scopes } from "./components/Scopes";

# Regular expression

<Scopes scopeTypeType="regularExpression" />
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { Scopes } from "./components/Scopes";

# Section

<Scopes scopeTypeType="section" />
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { Scopes } from "./components/Scopes";

# Selector

<Scopes scopeTypeType="selector" />
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { Scopes } from "./components/Scopes";

# Sentence

<Scopes scopeTypeType="sentence" />
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { Scopes } from "./components/Scopes";

# Statement

<Scopes scopeTypeType="statement" />
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { Scopes } from "./components/Scopes";

# String

<Scopes scopeTypeType="string" />
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { Scopes } from "./components/Scopes";

# Surrounding pair

<Scopes scopeTypeType="surroundingPair" />
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { Scopes } from "./components/Scopes";

# Text fragment

<Scopes scopeTypeType="textFragment" />
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { Scopes } from "./components/Scopes";

# Token

<Scopes scopeTypeType="token" />
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { Scopes } from "./components/Scopes";

# Type

<Scopes scopeTypeType="type" />
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { Scopes } from "./components/Scopes";

# Unit

<Scopes scopeTypeType="unit" />
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { Scopes } from "./components/Scopes";

# Url

<Scopes scopeTypeType="url" />
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { Scopes } from "./components/Scopes";

# Value

<Scopes scopeTypeType="value" />
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { Scopes } from "./components/Scopes";

# Word

<Scopes scopeTypeType="word" />
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { Scopes } from "./components/Scopes";

# Xml both tags

<Scopes scopeTypeType="xmlBothTags" />
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { Scopes } from "./components/Scopes";

# Xml element

<Scopes scopeTypeType="xmlElement" />
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { Scopes } from "./components/Scopes";

# Xml end tag

<Scopes scopeTypeType="xmlEndTag" />
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { Scopes } from "./components/Scopes";

# Xml start tag

<Scopes scopeTypeType="xmlStartTag" />
Loading
Loading