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] Add a "source code" field #14

Open
Ced-Sharp opened this issue Oct 11, 2020 · 7 comments
Open

[Feature Request] Add a "source code" field #14

Ced-Sharp opened this issue Oct 11, 2020 · 7 comments
Labels
on hold Waiting for new APIs in VS Code to allow this

Comments

@Ced-Sharp
Copy link

Since this is an extension to vscode, we should be able to use the vscode editor (monaco) as a field type.
A simple example would be adding complex data as json. I would prefer using monaco as a field rather than longtext
because it has color highlight and folding.

@kkukshtel
Copy link
Collaborator

This would be really cool @Ced-Sharp - how do you think that data should be stored in the data file itself. Woudl you think it's just a string? But the editor itself is monaco?

@Ced-Sharp
Copy link
Author

I see this as 2 different requests actually:

  1. A editor field (just monaco as a textfield, a replacement to the longtext field I suppose)
  2. A json field (would use monaco for editing json, and would be stored as-is in the json file I guess)

@kkukshtel
Copy link
Collaborator

The JSON storage itself (2) is achieved imo by the List field type - is there something else that you would want there?

For (1) yeah I think having a MonacoEditor as a FieldType would be a good addition. I'm not sure how that's implemented though. I also see that for Webviews in code it's not a feature they've added in yet: microsoft/vscode#87282

@Ced-Sharp
Copy link
Author

Monaco is available for browsers outside of vscode, maybe you could simply use it like you would in a browser with <script> and tags, but it would bring a lot of overhead.

I guess I could use lists for json, I might have misunderstood what they were.

@kkukshtel
Copy link
Collaborator

Based off of that linked issue it seems like it isn't as easy as that due to the sandbox that webviews are forced to run inside of for VS Code. For something like CDB I think this works because it's just an actual website, but VS Code's view is a bit more limited for security reasons. However there is a proposal on that site to just expose the editor via an API, which would ideally be how this happens as it would reduce the overhead of needing to repackage monaco for this extension (which like you said would bloat the install size and likely affect performance).

And yeah Lists I think would be a good use case for JSON schema that is shared between lines. You couldn't do fully arbitrary JSON yet with them (as in, totally unique per line), but something like that could be achieved with just using a longtext field or text field and parsing the JSON at your consumption point.

@Ced-Sharp
Copy link
Author

I see, I've never developped a vscode extension, so I had no idea of webview's limitations.
Well, I guess this can be labelled as "on hold" until that linked proposal is applied or rejected.

@kkukshtel kkukshtel added the on hold Waiting for new APIs in VS Code to allow this label Oct 12, 2020
@kkukshtel
Copy link
Collaborator

It giveth and taketh, that's for sure. Marked as on hold for now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
on hold Waiting for new APIs in VS Code to allow this
Projects
None yet
Development

No branches or pull requests

2 participants