wing icon indicating copy to clipboard operation
wing copied to clipboard

vscode no suggestions on extern syntax

Open staycoolcall911 opened this issue 2 years ago • 4 comments

I tried this:

Add an extern function. There's no way for me to figure out the syntax unless I copy it from an example or the language reference. My code:

bring cloud;

class GDPRService {
  api: cloud.Api;
  bucket: cloud.Bucket;

  extern
		  // ^ cursor here

  init() {
    this.api = new cloud.Api();
    this.bucket =  new cloud.Bucket();
    this.api.post("/doc/{id}", inflight (req) => {
      let id = req.vars.get("id");
      let origin = Json.stringify(req.body);
      this.bucket.put("origin${id}.txt", origin);
    });
  }
}

This happened:

No completion for the extern syntax: image

I expected this:

To get a guiding docstring or syntax completion.

Is there a workaround?

No response

Component

IDE Extension

Wing Version

0.26.7

Node.js Version

18.15.0

Platform(s)

MacOS

Anything else?

No response

Community Notes

  • Please vote by adding a 👍 reaction to the issue to help us prioritize.
  • If you are interested to work on this issue, please leave a comment.

staycoolcall911 avatar Aug 29 '23 12:08 staycoolcall911

@eladb Originally wanted the syntax for extern to be extern("path") instead of extern "path".

I didn't like this because it felt strange to introduce a function-call-esque modifier that didn't match other modifiers. I still feel this way, but it's not like the current method is any less unique (in a bad way). Now that we've had it for a while, pragmatically I think it makes sense to change it to extern("path") instead.

It also makes this issue significantly easier to implement. This syntax change shouldn't be difficult and IMO can be implemented as part of this issue

MarkMcCulloh avatar Nov 12 '23 19:11 MarkMcCulloh

I'm not sure not having a completion is a bug per se (an LSP can't come up with every possible thing you can type at every position in your code), but otherwise I agree with what Mark said above.

As a related improvement, if you write

class A {
  extern foo(): str;
}

It will help if we provide a helpful syntax error, like "Missing file name after extern. Try extern "./file.js" " instead of "Unknown parser error"

Chriscbr avatar Feb 27 '24 22:02 Chriscbr

Hi,

This issue hasn't seen activity in 90 days. Therefore, we are marking this issue as stale for now. It will be closed after 7 days. Feel free to re-open this issue when there's an update or relevant information to be added. Thanks!

github-actions[bot] avatar May 28 '24 06:05 github-actions[bot]

Hi,

This issue hasn't seen activity in 90 days. Therefore, we are marking this issue as stale for now. It will be closed after 7 days. Feel free to re-open this issue when there's an update or relevant information to be added. Thanks!

github-actions[bot] avatar Sep 19 '24 06:09 github-actions[bot]