Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feature request] Support renaming objects via the Rename Symbol context action (F2) #198

Open
FieteO opened this issue Jan 10, 2023 · 1 comment
Labels
enhancement New feature or request

Comments

@FieteO
Copy link
Contributor

FieteO commented Jan 10, 2023

From other extensions, I am used to renaming variables via the Rename Symbol context action (F2). This way, I can rename the declaration and all of it's usages without having to rely on search and replace.
Currently this is not supported by this extension (as far as I am aware of), but it would improve the user experience.

Example:

openapi: '3.0.2'
info:
  title: API Title
  version: '1.0'
servers:
  - url: https://api.server.test/v1
paths:
  /pets:
    get:
      description: Returns all pets from the system that the user has access to
      responses:
        '200':
          description: A list of pets.
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Pet'
  /pets/{id}:
    get:
      description: Returns the pet with the given id
      parameters:
      - name: id
        in: path
        description: ID of pet to use
        required: true
        schema:
          type: string
      responses:
        '200':
          description: A single pet
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Pet'
components:
  schemas:
    Pet:
      type: object
      properties:
        id:
          type: string
        name:
          type: string

As a user I could

  • put the mouse cursor on the pet definition in schemas and rename it and all it's references to i.e MyPet
  • put the mouse cursor on the $ref: '#/components/schemas/Pet' reference and rename all references and the referenced object to #/components/schemas/MyPet

such that the result would be:

openapi: '3.0.2'
info:
  title: API Title
  version: '1.0'
servers:
  - url: https://api.server.test/v1
paths:
  /pets:
    get:
      description: Returns all pets from the system that the user has access to
      responses:
        '200':
          description: A list of pets.
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/MyPet'
  /pets/{id}:
    get:
      description: Returns the pet with the given id
      parameters:
      - name: id
        in: path
        description: ID of pet to use
        required: true
        schema:
          type: string
      responses:
        '200':
          description: A single pet
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MyPet'
components:
  schemas:
    MyPet:
      type: object
      properties:
        id:
          type: string
        name:
          type: string
@FieteO FieteO changed the title Support renaming objects via Rename Symbol context action (F2) [feature request] Support renaming objects via Rename Symbol context action (F2) Jan 10, 2023
@FieteO FieteO changed the title [feature request] Support renaming objects via Rename Symbol context action (F2) [feature request] Support renaming objects via the Rename Symbol context action (F2) Jan 10, 2023
@isamauny isamauny added the enhancement New feature or request label Jan 10, 2023
@isamauny
Copy link
Contributor

Thanks for the suggestion, sounds like an interesting suggestion indeed. We will add this to the backlog and update here as we progress.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants