question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add action to add a type annotation

See original GitHub issue

What we want

We will make it so that the “clear” / “change” action, when applied to “type”, if there is no existing type annotation, will insert a : and leave the cursor afterwords so that the user can add a type.

For example:

function foo() {
  return "hello" // cursor at end of this line
}

User says “change type”, results in

function foo(): <cursor-here> {
  return "hello"
}

Implementation

We will leverage https://github.com/pokey/cursorless-vscode/issues/210 to make it so that target returned from “type” knows how to insert itself

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:13 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
AndreasArvidssoncommented, Jan 15, 2022

When the action is called change it makes perfect sense. As a clear command I’m a bit ambivalent. Also adding a new action for this very niche case is probably unnecessary.

0reactions
AndreasArvidssoncommented, Jan 15, 2022

Yes if the action is going to be change on even add the action name is definitely incorrect

Read more comments on GitHub >

github_iconTop Results From Across the Web

Understanding type annotation in Python - LogRocket Blog
This tutorial will explore type hints and how you can add them to your Python code. It will focus on the mypy static...
Read more >
Type annotation for Immutable.js Map when passing to Redux ...
I've been slowly adding Flow type annotations to a small Redux application. However, I'm stuck on adding an annotation for the state in...
Read more >
Actions - Documentation - Demo Kit - SAPUI5 SDK
Actions in the Table Toolbar. annotation-based. depends (see linked topics). List Report. Object Page. Adding Actions to Tables. Generic Action Buttons in ...
Read more >
Quick Fix Add "Optional" to Type Annotation doesn't work #1873
Environment data Language Server version: v2021.9.3 OS and version: Win10, 19043.1237 Python version (& distribution if applicable, ...
Read more >
Type hinting in PyCharm - JetBrains
Select a code element. · Press Alt+Enter . · Select Add type hint for .... · Press Enter to complete the action or...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found