Skip to content

Add scope type "type name" #2179

@wenkokke

Description

@wenkokke

The scope types include "class name" and "funk name" to match the names in, e.g., class and function declarations. However, it does not include a "type name" to match the name in a type declaration. I propose we add such a scope type.

// TypeScript
export type Tuple[A, B] = [A, B]
//          ^^^^^
# Python
_A = TypeVar("_A")
_B = TypeVar("_B")

Tuple: TypeAlias = tuple[_A, _B]
#^^^^ 
-- Haskell
type Tuple a b = (a, b)
--   ^^^^^

data Tuple a b = Tuple a b
--   ^^^^^

Activity

pokey

pokey commented on Jan 17, 2024

@pokey
Member

We've actually been considering deprecating "funk name" and "class name" as they're now almost completely equivalent to just chaining modifiers: "name funk" and "name class". They're a holdover from before modifiers could be chained. See #1518 for more discussion

I could see a consistency argument for supporting "type name" if we support "class name", but note that these scope types technically introduce ambiguity because "type name" could be parsed as a modifier chain: select name then select type

wenkokke

wenkokke commented on Jan 18, 2024

@wenkokke
Author

Yes, that's way better, please deprecate "class name" and "funk name" instead!

pokey

pokey commented on Jan 18, 2024

@pokey
Member

We'd love to deprecate those, but unfortunately we don't have a good answer for the exceptional case mentioned in the description of #1518 😕

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @pokey@wenkokke

        Issue actions

          Add scope type "type name" · Issue #2179 · cursorless-dev/cursorless