@@ -31,6 +31,7 @@ use project_model::{
31
31
CargoConfig , CargoFeatures , ProjectJson , ProjectJsonData , ProjectManifest , RustLibSource ,
32
32
} ;
33
33
use rustc_hash:: { FxHashMap , FxHashSet } ;
34
+ use semver:: Version ;
34
35
use serde:: { de:: DeserializeOwned , Deserialize } ;
35
36
use stdx:: format_to_acc;
36
37
use vfs:: { AbsPath , AbsPathBuf } ;
@@ -624,7 +625,7 @@ pub struct Config {
624
625
data : ConfigData ,
625
626
detached_files : Vec < AbsPathBuf > ,
626
627
snippets : Vec < Snippet > ,
627
- is_visual_studio_code : bool ,
628
+ visual_studio_code_version : Option < Version > ,
628
629
}
629
630
630
631
type ParallelCachePrimingNumThreads = u8 ;
@@ -823,7 +824,7 @@ impl Config {
823
824
root_path : AbsPathBuf ,
824
825
caps : ClientCapabilities ,
825
826
workspace_roots : Vec < AbsPathBuf > ,
826
- is_visual_studio_code : bool ,
827
+ visual_studio_code_version : Option < Version > ,
827
828
) -> Self {
828
829
Config {
829
830
caps,
@@ -833,7 +834,7 @@ impl Config {
833
834
root_path,
834
835
snippets : Default :: default ( ) ,
835
836
workspace_roots,
836
- is_visual_studio_code ,
837
+ visual_studio_code_version ,
837
838
}
838
839
}
839
840
@@ -1778,10 +1779,10 @@ impl Config {
1778
1779
self . data . typing_autoClosingAngleBrackets_enable
1779
1780
}
1780
1781
1781
- // FIXME: VSCode seems to work wrong sometimes, see https://github.com/microsoft/vscode/ issues/193124
1782
- // hence, distinguish it for now.
1783
- pub fn is_visual_studio_code ( & self ) -> bool {
1784
- self . is_visual_studio_code
1782
+ // VSCode is our reference implementation, so we allow ourselves to work around issues by
1783
+ // special casing certain versions
1784
+ pub fn visual_studio_code_version ( & self ) -> Option < & Version > {
1785
+ self . visual_studio_code_version . as_ref ( )
1785
1786
}
1786
1787
}
1787
1788
// Deserialization definitions
@@ -2694,7 +2695,7 @@ mod tests {
2694
2695
AbsPathBuf :: try_from ( project_root ( ) ) . unwrap ( ) ,
2695
2696
Default :: default ( ) ,
2696
2697
vec ! [ ] ,
2697
- false ,
2698
+ None ,
2698
2699
) ;
2699
2700
config
2700
2701
. update ( serde_json:: json!( {
@@ -2710,7 +2711,7 @@ mod tests {
2710
2711
AbsPathBuf :: try_from ( project_root ( ) ) . unwrap ( ) ,
2711
2712
Default :: default ( ) ,
2712
2713
vec ! [ ] ,
2713
- false ,
2714
+ None ,
2714
2715
) ;
2715
2716
config
2716
2717
. update ( serde_json:: json!( {
@@ -2726,7 +2727,7 @@ mod tests {
2726
2727
AbsPathBuf :: try_from ( project_root ( ) ) . unwrap ( ) ,
2727
2728
Default :: default ( ) ,
2728
2729
vec ! [ ] ,
2729
- false ,
2730
+ None ,
2730
2731
) ;
2731
2732
config
2732
2733
. update ( serde_json:: json!( {
@@ -2745,7 +2746,7 @@ mod tests {
2745
2746
AbsPathBuf :: try_from ( project_root ( ) ) . unwrap ( ) ,
2746
2747
Default :: default ( ) ,
2747
2748
vec ! [ ] ,
2748
- false ,
2749
+ None ,
2749
2750
) ;
2750
2751
config
2751
2752
. update ( serde_json:: json!( {
@@ -2764,7 +2765,7 @@ mod tests {
2764
2765
AbsPathBuf :: try_from ( project_root ( ) ) . unwrap ( ) ,
2765
2766
Default :: default ( ) ,
2766
2767
vec ! [ ] ,
2767
- false ,
2768
+ None ,
2768
2769
) ;
2769
2770
config
2770
2771
. update ( serde_json:: json!( {
@@ -2783,7 +2784,7 @@ mod tests {
2783
2784
AbsPathBuf :: try_from ( project_root ( ) ) . unwrap ( ) ,
2784
2785
Default :: default ( ) ,
2785
2786
vec ! [ ] ,
2786
- false ,
2787
+ None ,
2787
2788
) ;
2788
2789
config
2789
2790
. update ( serde_json:: json!( {
0 commit comments