codeapp icon indicating copy to clipboard operation
codeapp copied to clipboard

Plugins (Like VSC)

Open luni-moon opened this issue 4 years ago • 17 comments

I would like to see community supported plugins, like VSCode, but not from there, I mean new ones from scratch. It would really help with features the community would like to see, but the devs don’t have time or are not ready to add/support in the recent updates.

luni-moon avatar Feb 10 '21 14:02 luni-moon

This could be possible, but it would be rather restricted. I can see syntax highlighting for new languages, or color themes could be supported, and possibly code snippets since they can be represented as JSON files and contains no executable codes.

But ideally you'd want some degree of logic in the extension. Downloadable scripting languages like Python and Javascript are actually allowed on iOS. To achieve that, we would need to build a bridge between the native platform and those scripts. This could be rather difficult since the project isn't really stable enough to maintain a stable set of APIs.

Of course it would be even more ideal if the app could actually use VSCode extensions. Since VSCode extensions are written in Javascript anyway, extensions that don't need a node environment or other executable binary could work. (though I'm not ruling out the possibility to run node on iOS :) )

As a side project, I am actually also attempting to bring the web version of VSCode to iOS and it has some degree of VSCode extension support: https://medium.com/@thebaselab/my-attempt-to-run-vs-code-on-ipad-687aceaa82f4 In that way, it might be a better idea to port VSCode to iOS with the large existing community support.

Anyway, I'd like to hear more about the use cases of the plugins. What would you want to do with them?

bummoblizard avatar Feb 10 '21 15:02 bummoblizard

They don’t necessarily have to be written in JS, they could be written in SwiftUI, as I assume that is the language that this app is written in, based on the platform, but that could cause even more restriction, due to the cause of presumably less knowing Swift, over JS.

I would use it to allow programs to have certain user inputs in terminal, adding live previews (on iPadOS) for certain languages, in split screen mode, and much more.

luni-moon avatar Feb 10 '21 15:02 luni-moon

Also, I would like to see a plugin added for language terminal offline capabilities.

luni-moon avatar Feb 10 '21 16:02 luni-moon

You could also add Programming languages as downloadable in plugins which will further enhance the Terminal and This App by adding an Option to compile online with the server and then Offline with the plugins Downloaded Earlier

Rishi5813 avatar Feb 18 '21 10:02 Rishi5813

You could also add Programming languages as downloadable in plugins which will further enhance the Terminal and This App by adding an Option to compile online with the server and then Offline with the plugins Downloaded Earlier

That is a splendid idea, that is probably the best way to go for this type of feature.

luni-moon avatar Mar 28 '21 22:03 luni-moon

Also, I just reread:

Of course it would be even more ideal if the app could actually use VSCode extensions. Since VSCode extensions are written in Javascript anyway, extensions that don't need a node environment or other executable binary could work. (though I'm not ruling out the possibility to run node on iOS :) )

and the last part in parentheses, really stood out to me:

(though I'm not ruling out the possibility to run node on iOS :) )

Since the app now can run NODE, this would open up more possibilities to add plugins that are already in VSCode, contrary to my original request, although I would prefer it at some point, I can live with importing the important plugins from VSCode, for a while. @bummoblizard, let me know what you think. Thanks!

luni-moon avatar Apr 17 '21 14:04 luni-moon

I would love to get the SSH plugin, as that's my main use for an app like this. I don't have a way to edit my sever's files without it :/

eiiot avatar Apr 17 '21 19:04 eiiot

I would love to get the SSH plugin, as that's my main use for an app like this. I don't have a way to edit my sever's files without it :/

Noted! I understand this is quite useful.

bummoblizard avatar Apr 18 '21 04:04 bummoblizard

I would love to get the SSH plugin, as that's my main use for an app like this. I don't have a way to edit my sever's files without it :/

Noted! I understand this is quite useful.

I was actually able to access my files using Samba Share, however, the app doesn't allow me to open network folders, for some reason. It just crashes. Probably related to #62

eiiot avatar Apr 19 '21 17:04 eiiot

I would love to get the SSH plugin, as that's my main use for an app like this. I don't have a way to edit my sever's files without it :/

Noted! I understand this is quite useful.

I was actually able to access my files using Samba Share, however, the app doesn't allow me to open network folders, for some reason. It just crashes. Probably related to #62

Yeah, I would say it is related to #62. Also, @bummoblizard Is there going to be some sort of milestone attached to this, or is this too far in the future to know when or if it will be implemented?

luni-moon avatar May 14 '21 16:05 luni-moon

I would love to get the SSH plugin, as that's my main use for an app like this. I don't have a way to edit my sever's files without it :/

Noted! I understand this is quite useful.

I was actually able to access my files using Samba Share, however, the app doesn't allow me to open network folders, for some reason. It just crashes. Probably related to #62

Yeah, I would say it is related to #62. Also, @bummoblizard Is there going to be some sort of milestone attached to this, or is this too far in the future to know when or if it will be implemented?

I'll try to add this in the next release.

bummoblizard avatar May 14 '21 21:05 bummoblizard

+1 for vscode plug-ins. Sadly I can’t use this app because our company repos use es-lint and when I run

npm run serve

it fails with…

Screenshot 2021-08-21 at 6 04 38 pm

chris-copleston avatar Aug 21 '21 17:08 chris-copleston

+1 for vscode plug-ins, my main use of vscode is using Remote Development via SSH, which I can offload all the processing overhead to my server, and have no problem switching working environment between machine

ckanthony avatar Oct 11 '21 13:10 ckanthony

@bummoblizard Are there any updates on this?

luni-moon avatar Nov 02 '21 17:11 luni-moon

is LiveShare an option in this app?

zaptrem avatar Mar 24 '22 16:03 zaptrem

is LiveShare an option in this app?

I do not think so, yet.

luni-moon avatar Mar 24 '22 19:03 luni-moon

Why was this issued referenced in that commit 🤔

luni-moon avatar Sep 14 '22 23:09 luni-moon

I've introduced something called extensions in the recent commits. Although it cannot be dynamically loaded, nor compatible with VS code extensions, it allows a way to extend the editor functionalities in an enclosed environment.

For instance, this single file adds support for viewing images in Code App.

//
//  ImageEditorExtension.swift
//  Code
//
//  Created by Ken Chung on 22/11/2022.
//

import SwiftUI


private class Storage: ObservableObject {
    @Published var data: Data? = nil
}

private struct ImageContextMenu: View {
    
    let uiImage: UIImage
    
    var body: some View {
        Button {
            UIImageWriteToSavedPhotosAlbum(uiImage, nil, nil, nil)
        } label: {
            Label("Add to Photos", systemImage: "square.and.arrow.down")
        }
        Button {
            UIPasteboard.general.image = uiImage
        } label: {
            Label("Copy Image", systemImage: "doc.on.doc")
        }
        
    }
    
}

private struct ImageView: View {
    
    @EnvironmentObject var storage: Storage
    
    var body: some View {
        if let data = storage.data {
            if let uiImage = UIImage(data: data) {
                Image(uiImage: uiImage)
                    .resizable()
                    .scaledToFit()
                    .contextMenu {
                        ImageContextMenu(uiImage: uiImage)
                    }
            }else{
                Text("Unsupported image")
            }
        }else{
            Text("Loading Image")
        }
    }
    
}


class ImageEditorExtension: CodeAppExtension {

    override func onInitialize(app: MainApp, contribution: CodeAppExtension.Contribution) {
        let provider = EditorProvider(
            registeredFileExtensions: ["png", "tiff", "tif", "jpeg", "jpg", "gif", "bmp", "bmp", "BMPf", "ico", "cur", "xbm", "heic", "webp"],
            onCreateEditor: { url in
                let storage = Storage()
                let editorInstance = EditorInstanceWithURL(
                    view: AnyView(ImageView().environmentObject(storage)),
                    title: url.lastPathComponent,
                    url: url
                )
                
                app.workSpaceStorage.contents(at: url, completionHandler: { data, error in
                    storage.data = data
                    if let error {
                        app.notificationManager.showErrorMessage(error.localizedDescription)
                    }
                })
                
                return editorInstance
            }
        )
        contribution.editorProvider.register(provider: provider)
    }
}

bummoblizard avatar Nov 22 '22 14:11 bummoblizard

That's exactly what I was looking for to be added! Is there a way we can make our own .swift extension files, and import them - preferably from the app? If not, I know that may be a lot of work, but it'd be sick! Keep up the awesome work!

luni-moon avatar Dec 01 '22 14:12 luni-moon

Right now you need to compile the app from Xcode. But in the future it is possible to build a JS bridge to enable dynamic extensions.

bummoblizard avatar Dec 02 '22 03:12 bummoblizard

Right now you need to compile the app from Xcode. But in the future it is possible to build a JS bridge to enable dynamic extensions.

Ah, ok. Got it. I know this is probably in the README, or another issue, but what version of Xcode and Swift is needed to compile the app? Right now I am stuck on Swift 5.x.x, and Xcode 12.x, if I recall correctly (due to macOS Catalina as the last update available on m (13,2) iMac)

luni-moon avatar Dec 02 '22 13:12 luni-moon

I’m using the latest version but Xcode 12 should be fine.

「BatemaDevelopment @.***>」在 2022年12月2日 週五,21:39 寫道:

Right now you need to compile the app from Xcode. But in the future it is possible to build a JS bridge to enable dynamic extensions.

Ah, ok. Got it. I know this is probably in the README, or another issue, but what version of Xcode and Swift is needed to compile the app? Right now I am stuck on Swift 5.x.x, and Xcode 12.x, if I recall correctly.

— Reply to this email directly, view it on GitHub https://github.com/thebaselab/codeapp/issues/28#issuecomment-1335247750, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJE6T22H2DX2JRTWDYZL6MTWLH32TANCNFSM4XNDFP7A . You are receiving this because you were mentioned.Message ID: @.***>

bummoblizard avatar Dec 02 '22 16:12 bummoblizard

I’m using the latest version but Xcode 12 should be fine.

「BatemaDevelopment @.***>」在 2022年12月2日 週五,21:39 寫道:

Right now you need to compile the app from Xcode. But in the future it is possible to build a JS bridge to enable dynamic extensions.

Ah, ok. Got it. I know this is probably in the README, or another issue, but what version of Xcode and Swift is needed to compile the app? Right now I am stuck on Swift 5.x.x, and Xcode 12.x, if I recall correctly.

— Reply to this email directly, view it on GitHub https://github.com/thebaselab/codeapp/issues/28#issuecomment-1335247750, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJE6T22H2DX2JRTWDYZL6MTWLH32TANCNFSM4XNDFP7A . You are receiving this because you were mentioned.Message ID: @.***>

Thanks for the info! I'll try to do so!

luni-moon avatar Dec 08 '22 23:12 luni-moon