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
6 changes: 3 additions & 3 deletions data/fixtures/recorded/languages/ruby/chuckArg3.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ initialState:
marks: {}
finalState:
documentContents: |
[1, 2, 3].each_with_the_next { |n, | }
[1, 2, 3].each_with_the_next { |n| }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

selections:
- anchor: {line: 0, character: 35}
active: {line: 0, character: 35}
- anchor: {line: 0, character: 33}
active: {line: 0, character: 33}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
* The language IDs that we have full tree-sitter support for using our legacy
* modifiers.
*/
export const legacyLanguageIds = ["clojure", "latex", "ruby", "rust"] as const;
export const legacyLanguageIds = ["clojure", "latex", "rust"] as const;

export type LegacyLanguageId = (typeof legacyLanguageIds)[number];
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,24 @@ import { QueryPredicateOperator } from "./QueryPredicateOperator";
import { q } from "./operatorArgumentSchemaTypes";

/**
* A predicate operator that returns true if the node is not of the given type.
* For example, `(not-type? @foo string)` will reject the match if the `@foo`
* A predicate operator that returns true if the node is of the given type.
* For example, `(#type? @foo string)` will accept the match if the `@foo`
* capture is a `string` node. It is acceptable to pass in multiple types, e.g.
* `(not-type? @foo string comment)`.
* `(#type? @foo string comment)`.
*/
class Type extends QueryPredicateOperator<Type> {
name = "type?" as const;
schema = z.tuple([q.node, q.string]).rest(q.string);
run({ node }: MutableQueryCapture, ...types: string[]) {
return types.includes(node.type);
}
}

/**
* A predicate operator that returns true if the node is NOT of the given type.
* For example, `(#not-type? @foo string)` will reject the match if the `@foo`
* capture is a `string` node. It is acceptable to pass in multiple types, e.g.
* `(#not-type? @foo string comment)`.
*/
class NotType extends QueryPredicateOperator<NotType> {
name = "not-type?" as const;
Expand All @@ -22,9 +36,9 @@ class NotType extends QueryPredicateOperator<NotType> {

/**
* A predicate operator that returns true if the node's parent is not of the
* given type. For example, `(not-parent-type? @foo string)` will reject the
* given type. For example, `(#not-parent-type? @foo string)` will reject the
* match if the `@foo` capture is a child of a `string` node. It is acceptable
* to pass in multiple types, e.g. `(not-parent-type? @foo string comment)`.
* to pass in multiple types, e.g. `(#not-parent-type? @foo string comment)`.
*/
class NotParentType extends QueryPredicateOperator<NotParentType> {
name = "not-parent-type?" as const;
Expand All @@ -36,7 +50,7 @@ class NotParentType extends QueryPredicateOperator<NotParentType> {

/**
* A predicate operator that returns true if the node is the nth child of its
* parent. For example, `(is-nth-child? @foo 0)` will reject the match if the
* parent. For example, `(#is-nth-child? @foo 0)` will reject the match if the
* `@foo` capture is not the first child of its parent.
*/
class IsNthChild extends QueryPredicateOperator<IsNthChild> {
Expand All @@ -49,7 +63,7 @@ class IsNthChild extends QueryPredicateOperator<IsNthChild> {

/**
* A predicate operator that returns true if the node has more than 1 child of
* type {@link type} (inclusive). For example, `(has-multiple-children-of-type?
* type {@link type} (inclusive). For example, `(#has-multiple-children-of-type?
* @foo bar)` will accept the match if the `@foo` capture has 2 or more children
* of type `bar`.
*/
Expand Down Expand Up @@ -374,6 +388,7 @@ class EmptySingleMultiDelimiter extends QueryPredicateOperator<EmptySingleMultiD

export const queryPredicateOperators = [
new Log(),
new Type(),
new NotType(),
new TrimEnd(),
new DocumentRange(),
Expand Down
2 changes: 0 additions & 2 deletions packages/cursorless-engine/src/languages/getNodeMatcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import { selectionWithEditorFromRange } from "../util/selectionUtils";
import clojure from "./clojure";
import type { LegacyLanguageId } from "./LegacyLanguageId";
import latex from "./latex";
import { patternMatchers as ruby } from "./ruby";
import rust from "./rust";

export function getNodeMatcher(
Expand Down Expand Up @@ -44,7 +43,6 @@ export const languageMatchers: Record<
> = {
clojure,
latex,
ruby,
rust,
};

Expand Down
188 changes: 0 additions & 188 deletions packages/cursorless-engine/src/languages/ruby.ts

This file was deleted.

Loading
Loading