Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
f0a3108f
Unverified
Commit
f0a3108f
authored
Apr 18, 2021
by
Jenn Magder
Committed by
GitHub
Apr 18, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Show VS Code Insiders in doctor (#80620)
parent
515003e4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
33 deletions
+11
-33
vscode.dart
packages/flutter_tools/lib/src/vscode/vscode.dart
+4
-22
vscode_test.dart
.../flutter_tools/test/general.shard/vscode/vscode_test.dart
+7
-11
No files found.
packages/flutter_tools/lib/src/vscode/vscode.dart
View file @
f0a3108f
...
...
@@ -13,9 +13,6 @@ import '../base/version.dart';
import
'../convert.dart'
;
import
'../doctor_validator.dart'
;
// Include VS Code insiders (useful for debugging).
const
bool
_includeInsiders
=
false
;
const
String
extensionIdentifier
=
'Dart-Code.flutter'
;
const
String
extensionMarketplaceUrl
=
'https://marketplace.visualstudio.com/items?itemName=
$extensionIdentifier
'
;
...
...
@@ -155,7 +152,6 @@ class VsCode {
VsCodeInstallLocation
(
fileSystem
.
path
.
join
(
'/Applications'
,
'Visual Studio Code - Insiders.app'
,
'Contents'
),
'.vscode-insiders'
,
isInsiders:
true
,
),
if
(
homeDirPath
!=
null
)
VsCodeInstallLocation
(
...
...
@@ -166,7 +162,6 @@ class VsCode {
'Contents'
,
),
'.vscode-insiders'
,
isInsiders:
true
,
),
for
(
final
String
vsCodePath
in
LineSplitter
.
split
(
vsCodeSpotlightResult
))
VsCodeInstallLocation
(
...
...
@@ -177,7 +172,6 @@ class VsCode {
VsCodeInstallLocation
(
fileSystem
.
path
.
join
(
vsCodeInsidersPath
,
'Contents'
),
'.vscode-insiders'
,
isInsiders:
true
,
),
},
fileSystem
,
platform
);
}
...
...
@@ -219,7 +213,6 @@ class VsCode {
fileSystem
.
path
.
join
(
progFiles86
,
'Microsoft VS Code Insiders'
),
'.vscode-insiders'
,
edition:
'32-bit edition'
,
isInsiders:
true
,
),
],
if
(
progFiles
!=
null
)
...
...
@@ -233,14 +226,12 @@ class VsCode {
fileSystem
.
path
.
join
(
progFiles
,
'Microsoft VS Code Insiders'
),
'.vscode-insiders'
,
edition:
'64-bit edition'
,
isInsiders:
true
,
),
],
if
(
localAppData
!=
null
)
VsCodeInstallLocation
(
fileSystem
.
path
.
join
(
localAppData
,
r'Programs\Microsoft VS Code Insiders'
),
'.vscode-insiders'
,
isInsiders:
true
,
),
];
return
_findInstalled
(
searchLocations
,
fileSystem
,
platform
);
...
...
@@ -258,7 +249,6 @@ class VsCode {
const
VsCodeInstallLocation
(
'/usr/share/code-insiders'
,
'.vscode-insiders'
,
isInsiders:
true
,
),
],
fileSystem
,
platform
);
}
...
...
@@ -268,14 +258,9 @@ class VsCode {
FileSystem
fileSystem
,
Platform
platform
,
)
{
final
Iterable
<
VsCodeInstallLocation
>
searchLocations
=
_includeInsiders
?
allLocations
:
allLocations
.
where
((
VsCodeInstallLocation
p
)
=>
p
.
isInsiders
!=
true
);
final
List
<
VsCode
>
results
=
<
VsCode
>[];
for
(
final
VsCodeInstallLocation
searchLocation
in
search
Locations
)
{
for
(
final
VsCodeInstallLocation
searchLocation
in
all
Locations
)
{
final
String
?
homeDirPath
=
FileSystemUtils
(
fileSystem:
fileSystem
,
platform:
platform
).
homeDirPath
;
if
(
homeDirPath
!=
null
&&
fileSystem
.
isDirectorySync
(
searchLocation
.
installPath
))
{
final
String
extensionDirectory
=
fileSystem
.
path
.
join
(
...
...
@@ -323,24 +308,21 @@ class VsCodeInstallLocation {
this
.
installPath
,
this
.
extensionsFolder
,
{
this
.
edition
,
bool
?
isInsiders
})
:
isInsiders
=
isInsiders
??
false
;
});
final
String
installPath
;
final
String
extensionsFolder
;
final
String
?
edition
;
final
bool
isInsiders
;
@override
bool
operator
==(
Object
other
)
{
return
other
is
VsCodeInstallLocation
&&
other
.
installPath
==
installPath
&&
other
.
extensionsFolder
==
extensionsFolder
&&
other
.
edition
==
edition
&&
other
.
isInsiders
==
isInsiders
;
other
.
edition
==
edition
;
}
@override
// Lowest bit is for isInsiders boolean.
int
get
hashCode
=>
(
installPath
.
hashCode
^
extensionsFolder
.
hashCode
^
edition
.
hashCode
)
<<
1
|
(
isInsiders
?
1
:
0
)
;
int
get
hashCode
=>
installPath
.
hashCode
^
extensionsFolder
.
hashCode
^
edition
.
hashCode
;
}
packages/flutter_tools/test/general.shard/vscode/vscode_test.dart
View file @
f0a3108f
...
...
@@ -13,12 +13,11 @@ import '../../src/fake_process_manager.dart';
void
main
(
)
{
testWithoutContext
(
'VsCodeInstallLocation equality'
,
()
{
const
VsCodeInstallLocation
installLocation1
=
VsCodeInstallLocation
(
'abc'
,
'zyx'
,
edition:
'123'
,
isInsiders:
true
);
const
VsCodeInstallLocation
installLocation2
=
VsCodeInstallLocation
(
'abc'
,
'zyx'
,
edition:
'123'
,
isInsiders:
true
);
const
VsCodeInstallLocation
installLocation3
=
VsCodeInstallLocation
(
'cba'
,
'zyx'
,
edition:
'123'
,
isInsiders:
true
);
const
VsCodeInstallLocation
installLocation4
=
VsCodeInstallLocation
(
'abc'
,
'xyz'
,
edition:
'123'
,
isInsiders:
true
);
const
VsCodeInstallLocation
installLocation5
=
VsCodeInstallLocation
(
'abc'
,
'xyz'
,
edition:
'321'
,
isInsiders:
true
);
const
VsCodeInstallLocation
installLocation6
=
VsCodeInstallLocation
(
'abc'
,
'zyx'
,
edition:
'123'
,
isInsiders:
false
);
const
VsCodeInstallLocation
installLocation1
=
VsCodeInstallLocation
(
'abc'
,
'zyx'
,
edition:
'123'
);
const
VsCodeInstallLocation
installLocation2
=
VsCodeInstallLocation
(
'abc'
,
'zyx'
,
edition:
'123'
);
const
VsCodeInstallLocation
installLocation3
=
VsCodeInstallLocation
(
'cba'
,
'zyx'
,
edition:
'123'
);
const
VsCodeInstallLocation
installLocation4
=
VsCodeInstallLocation
(
'abc'
,
'xyz'
,
edition:
'123'
);
const
VsCodeInstallLocation
installLocation5
=
VsCodeInstallLocation
(
'abc'
,
'xyz'
,
edition:
'321'
);
expect
(
installLocation1
,
installLocation2
);
expect
(
installLocation1
.
hashCode
,
installLocation2
.
hashCode
);
...
...
@@ -28,8 +27,6 @@ void main() {
expect
(
installLocation1
.
hashCode
,
isNot
(
installLocation4
.
hashCode
));
expect
(
installLocation1
,
isNot
(
installLocation5
));
expect
(
installLocation1
.
hashCode
,
isNot
(
installLocation5
.
hashCode
));
expect
(
installLocation1
,
isNot
(
installLocation6
));
expect
(
installLocation1
.
hashCode
,
isNot
(
installLocation6
.
hashCode
));
});
testWithoutContext
(
'VsCode.fromDirectory does not crash when packages.json is malformed'
,
()
{
...
...
@@ -44,7 +41,7 @@ void main() {
expect
(
vsCode
.
version
,
Version
.
unknown
);
});
testWithoutContext
(
'can locate
non-Insider
installations on macOS'
,
()
{
testWithoutContext
(
'can locate installations on macOS'
,
()
{
final
FileSystem
fileSystem
=
MemoryFileSystem
.
test
();
const
String
home
=
'/home/me'
;
final
Platform
platform
=
FakePlatform
(
operatingSystem:
'macos'
,
environment:
<
String
,
String
>{
'HOME'
:
home
});
...
...
@@ -86,8 +83,7 @@ void main() {
]);
final
List
<
VsCode
>
installed
=
VsCode
.
allInstalled
(
fileSystem
,
platform
,
processManager
);
// Finds three non-Insider installations.
expect
(
installed
.
length
,
3
);
expect
(
installed
.
length
,
6
);
expect
(
processManager
,
hasNoRemainingExpectations
);
});
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment