Unverified Commit 77503bdb authored by Kristijan Žic's avatar Kristijan Žic Committed by GitHub

Added support for vscode and vscode-insiders installed via Flatpak (#137123)

Closes #137122

<b>Before</b>
VS Code and VS Code Insiders installed via Flatpak aren't detected

<b>After</b>
```sh
[✓] VS Code (version 1.82.2)
    • VS Code at /var/lib/flatpak/app/com.visualstudio.code/x86_64/stable/active/files/extra/vscode
    • Flutter extension version 3.74.0

[✓] VS Code (version 1.84.0-insider)
    • VS Code at /var/lib/flatpak/app/com.visualstudio.code.insiders/x86_64/beta/active/files/extra/vscode-insiders
    • Flutter extension version 3.75.20231002
```
parent 909e529e
......@@ -237,17 +237,30 @@ class VsCode {
}
// Linux:
// Deb:
// /usr/share/code/bin/code
// /snap/code/current/usr/share/code
// /usr/share/code-insiders/bin/code-insiders
// /snap/code-insiders/current/usr/share/code-insiders
// Snap:
// /snap/code/current/usr/share/code
// Flatpak:
// /var/lib/flatpak/app/com.visualstudio.code/x86_64/stable/active/files/extra/vscode
// /var/lib/flatpak/app/com.visualstudio.code.insiders/x86_64/beta/active/files/extra/vscode-insiders
// Linux Extensions:
// Deb:
// $HOME/.vscode/extensions
// $HOME/.vscode-insiders/extensions
// Snap:
// $HOME/.vscode/extensions
// Flatpak:
// $HOME/.var/app/com.visualstudio.code/data/vscode/extensions
// $HOME/.var/app/com.visualstudio.code.insiders/data/vscode-insiders/extensions
static List<VsCode> _installedLinux(FileSystem fileSystem, Platform platform) {
return _findInstalled(<VsCodeInstallLocation>[
const VsCodeInstallLocation('/usr/share/code', '.vscode'),
const VsCodeInstallLocation('/snap/code/current/usr/share/code', '.vscode'),
const VsCodeInstallLocation(
'/var/lib/flatpak/app/com.visualstudio.code/x86_64/stable/active/files/extra/vscode',
'.var/app/com.visualstudio.code/data/vscode',
),
const VsCodeInstallLocation(
'/usr/share/code-insiders',
'.vscode-insiders',
......@@ -256,6 +269,10 @@ class VsCode {
'/snap/code-insiders/current/usr/share/code-insiders',
'.vscode-insiders',
),
const VsCodeInstallLocation(
'/var/lib/flatpak/app/com.visualstudio.code.insiders/x86_64/beta/active/files/extra/vscode-insiders',
'.var/app/com.visualstudio.code.insiders/data/vscode-insiders',
),
], fileSystem, platform);
}
......
......@@ -54,6 +54,27 @@ void main() {
expect(installed.length, 2);
});
testWithoutContext('can locate VS Code installed via Flatpak', () {
final FileSystem fileSystem = MemoryFileSystem.test();
const String home = '/home/me';
final Platform platform = FakePlatform(environment: <String, String>{'HOME': home});
fileSystem.directory(fileSystem.path.join(
'/var/lib/flatpak/app/com.visualstudio.code/x86_64/stable/active/files/extra/vscode',
'.var/app/com.visualstudio.code/data/vscode',
)).createSync(recursive: true);
fileSystem.directory(fileSystem.path.join(
'/var/lib/flatpak/app/com.visualstudio.code.insiders/x86_64/beta/active/files/extra/vscode-insiders',
'.var/app/com.visualstudio.code.insiders/data/vscode-insiders',
)).createSync(recursive: true);
final FakeProcessManager processManager = FakeProcessManager.list(<FakeCommand>[]);
final List<VsCode> installed = VsCode.allInstalled(fileSystem, platform, processManager);
expect(installed.length, 2);
});
testWithoutContext('can locate installations on macOS', () {
final FileSystem fileSystem = MemoryFileSystem.test();
const String home = '/home/me';
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment