@@ -31,6 +31,7 @@ use project_model::{
3131 CargoConfig , CargoFeatures , ProjectJson , ProjectJsonData , ProjectManifest , RustLibSource ,
3232} ;
3333use rustc_hash:: { FxHashMap , FxHashSet } ;
34+ use semver:: Version ;
3435use serde:: { de:: DeserializeOwned , Deserialize } ;
3536use stdx:: format_to_acc;
3637use vfs:: { AbsPath , AbsPathBuf } ;
@@ -624,7 +625,7 @@ pub struct Config {
624625 data : ConfigData ,
625626 detached_files : Vec < AbsPathBuf > ,
626627 snippets : Vec < Snippet > ,
627- is_visual_studio_code : bool ,
628+ visual_studio_code_version : Option < Version > ,
628629}
629630
630631type ParallelCachePrimingNumThreads = u8 ;
@@ -823,7 +824,7 @@ impl Config {
823824 root_path : AbsPathBuf ,
824825 caps : ClientCapabilities ,
825826 workspace_roots : Vec < AbsPathBuf > ,
826- is_visual_studio_code : bool ,
827+ visual_studio_code_version : Option < Version > ,
827828 ) -> Self {
828829 Config {
829830 caps,
@@ -833,7 +834,7 @@ impl Config {
833834 root_path,
834835 snippets : Default :: default ( ) ,
835836 workspace_roots,
836- is_visual_studio_code ,
837+ visual_studio_code_version ,
837838 }
838839 }
839840
@@ -1778,10 +1779,10 @@ impl Config {
17781779 self . data . typing_autoClosingAngleBrackets_enable
17791780 }
17801781
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 ( )
17851786 }
17861787}
17871788// Deserialization definitions
@@ -2694,7 +2695,7 @@ mod tests {
26942695 AbsPathBuf :: try_from ( project_root ( ) ) . unwrap ( ) ,
26952696 Default :: default ( ) ,
26962697 vec ! [ ] ,
2697- false ,
2698+ None ,
26982699 ) ;
26992700 config
27002701 . update ( serde_json:: json!( {
@@ -2710,7 +2711,7 @@ mod tests {
27102711 AbsPathBuf :: try_from ( project_root ( ) ) . unwrap ( ) ,
27112712 Default :: default ( ) ,
27122713 vec ! [ ] ,
2713- false ,
2714+ None ,
27142715 ) ;
27152716 config
27162717 . update ( serde_json:: json!( {
@@ -2726,7 +2727,7 @@ mod tests {
27262727 AbsPathBuf :: try_from ( project_root ( ) ) . unwrap ( ) ,
27272728 Default :: default ( ) ,
27282729 vec ! [ ] ,
2729- false ,
2730+ None ,
27302731 ) ;
27312732 config
27322733 . update ( serde_json:: json!( {
@@ -2745,7 +2746,7 @@ mod tests {
27452746 AbsPathBuf :: try_from ( project_root ( ) ) . unwrap ( ) ,
27462747 Default :: default ( ) ,
27472748 vec ! [ ] ,
2748- false ,
2749+ None ,
27492750 ) ;
27502751 config
27512752 . update ( serde_json:: json!( {
@@ -2764,7 +2765,7 @@ mod tests {
27642765 AbsPathBuf :: try_from ( project_root ( ) ) . unwrap ( ) ,
27652766 Default :: default ( ) ,
27662767 vec ! [ ] ,
2767- false ,
2768+ None ,
27682769 ) ;
27692770 config
27702771 . update ( serde_json:: json!( {
@@ -2783,7 +2784,7 @@ mod tests {
27832784 AbsPathBuf :: try_from ( project_root ( ) ) . unwrap ( ) ,
27842785 Default :: default ( ) ,
27852786 vec ! [ ] ,
2786- false ,
2787+ None ,
27872788 ) ;
27882789 config
27892790 . update ( serde_json:: json!( {
0 commit comments