swiftlang / vscode-swift

Visual Studio Code Extension for Swift
https://marketplace.visualstudio.com/items?itemName=sswg.swift-lang
Apache License 2.0
726 stars 50 forks source link

Install the extension from VSCode Marketplace and open a Swift package not working in script with unique identifier #698

Closed KrisSimon closed 6 months ago

KrisSimon commented 6 months ago

Describe the bug The documentation says about installation: Install the extension from VSCode Marketplace https://marketplace.visualstudio.com/items?itemName=sswg.swift-lang.

In our docker script we try to use the unique identifier to automate the installation of this extensions, but sswg.swift-lang can't be found

To Reproduce Steps to reproduce the behavior: Install vscode in a docker environent and install extensions:

# Install publice xtensions  
RUN for ext in sswg.swift-lang vadimcn.vscode-lldb zaaack.markdown-editor ms-toolsai.jupyter ms-python.python; do \
  code-server --disable-telemetry --extensions-dir /extensions --install-extension ${ext}; \
  done;

# Install user extensions
RUN for ext in $(find /extensions/install/ -name "*.vsix"); do \
  code-server --disable-telemetry --extensions-dir /extensions --install-extension ${ext}; \
  done;

You can find a full Dockerfile in this project

An error is presented while docker build:

Extension 'sswg.swift-lang' not found.
Make sure you use the full extension ID, including the publisher, e.g.: ms-dotnettools.csharp
Failed Installing Extensions: sswg.swift-lang

You may want to see the output from this action: https://github.com/uitsmijter/swift-codeserver/actions/runs/7991622623/job/21823216231#step:6:15995

Expected behavior I would expect that the latest version of vscode-swift can be installed with the unique identifier sswg.swift-lang.

Environment

Current workaround As a workaround, we currently build the extension from source, upload the vsix-file and ship the vscode extension vscode-swift within the deployment files. This has downsides, because we can not update the extension based on the official repository, we need to maintain the extension, updates and build process on our own. We are detached from your excellent work here and with our own build of the extension we are less trustworthy.

Additional context For Uitsmijter, I am currently working on this discussion. The toolchain will get a new command: code to run a working environment inside a container on your local machine to start development easily.

adam-fowler commented 6 months ago

I can install extension using code --install-extension sswg.swift-lang. The swift extension does not support running in the browser.

KrisSimon commented 6 months ago

Hi @adam-fowler thanks for reply. Strange that you can install the extension, but my docker file can't. Even when I search for it in a running code server instance I can't find it in the results. See provided Dockerfile and log output from the action.

Interesting information, what is stopping the extension from running inside a browser based vscode instance? To my understanding it is only the vscode-gui running in a browser. All swift language runs inside Docker on Ubuntu. So for Uitsmijter, the code runs fine with swift run and swift test in the environment. The lldb integration (brakepoints) also works like a charm. Can you explain why it is not meant to run in a browser?

adam-fowler commented 6 months ago

I can install the extension in code. You are attempting to install it in code-server.

adam-fowler commented 6 months ago

The extension has no browser based version, so you can't use it from github.dev, but you can use it from a web client connected to a VSCode server. Try using code serve-web --host 127.0.0.1 --port 8081 and follow the directions. You can install the swift extension from the browser.

KrisSimon commented 6 months ago

Thanks Adam for your kind support. I'll go with a pre-downloaded version, and integrate a version lookup (downloading) into the pipeline later on.