diff --git a/kclvm/sema/src/resolver/global.rs b/kclvm/sema/src/resolver/global.rs index 6ea805ab1..52f71a60d 100644 --- a/kclvm/sema/src/resolver/global.rs +++ b/kclvm/sema/src/resolver/global.rs @@ -568,23 +568,6 @@ impl<'ctx> Resolver<'ctx> { }; // Schema attributes let mut attr_obj_map: IndexMap = IndexMap::default(); - let settings_dummy_pos = Position { - filename: self.ctx.filename.clone(), - line: pos.line, - column: pos.column, - }; - attr_obj_map.insert( - kclvm_runtime::SCHEMA_SETTINGS_ATTR_NAME.to_string(), - SchemaAttr { - is_optional: true, - has_default: false, - default: None, - ty: Type::dict_ref(self.str_ty(), self.any_ty()), - range: (settings_dummy_pos.clone(), settings_dummy_pos), - doc: None, - decorators: vec![], - }, - ); let parsed_doc = parse_doc_string( &schema_stmt .doc diff --git a/kclvm/tools/src/LSP/src/completion.rs b/kclvm/tools/src/LSP/src/completion.rs index 45f9daff6..fd8176e0f 100644 --- a/kclvm/tools/src/LSP/src/completion.rs +++ b/kclvm/tools/src/LSP/src/completion.rs @@ -533,18 +533,16 @@ pub(crate) fn get_dot_completion( // ``` kclvm_sema::ty::TypeKind::Schema(schema) => { for (name, attr) in &schema.attrs { - if name != "__settings__" { - items.insert(KCLCompletionItem { - label: name.clone(), - detail: Some(format!( - "{}: {}", - name, - attr.ty.ty_str() - )), - documentation: attr.doc.clone(), - kind: Some(KCLCompletionItemKind::SchemaAttr), - }); - } + items.insert(KCLCompletionItem { + label: name.clone(), + detail: Some(format!( + "{}: {}", + name, + attr.ty.ty_str() + )), + documentation: attr.doc.clone(), + kind: Some(KCLCompletionItemKind::SchemaAttr), + }); } } @@ -748,7 +746,7 @@ mod tests { CompletionResponse::List(_) => panic!("test failed"), }; - expected_labels.extend(["__settings__", "name", "age"]); + expected_labels.extend(["name", "age"]); assert_eq!(got_labels, expected_labels); } @@ -871,7 +869,7 @@ mod tests { CompletionResponse::List(_) => panic!("test failed"), }; - let expected_labels: Vec<&str> = vec!["__settings__", "a"]; + let expected_labels: Vec<&str> = vec!["a"]; assert_eq!(got_labels, expected_labels); } @@ -995,7 +993,7 @@ mod tests { CompletionResponse::List(_) => panic!("test failed"), }; - let expected_labels: Vec<&str> = vec!["__settings__", "a"]; + let expected_labels: Vec<&str> = vec!["a"]; assert_eq!(got_labels, expected_labels); } @@ -1163,7 +1161,7 @@ mod tests { CompletionItem { label: "Person(b){}".to_string(), kind: Some(CompletionItemKind:: CLASS), - detail: Some("__main__\n\nschema Person[b: int](Base)\nAttributes:\n__settings__?: {str:any}\nc: int".to_string()), + detail: Some("__main__\n\nschema Person[b: int](Base)\nAttributes:\nc: int".to_string()), documentation: Some(lsp_types::Documentation::String("".to_string())), ..Default::default() } diff --git a/kclvm/tools/src/LSP/src/hover.rs b/kclvm/tools/src/LSP/src/hover.rs index 407f5c568..34f5d34d3 100644 --- a/kclvm/tools/src/LSP/src/hover.rs +++ b/kclvm/tools/src/LSP/src/hover.rs @@ -181,7 +181,7 @@ mod tests { if let MarkedString::String(s) = vec[2].clone() { assert_eq!( s, - "Attributes:\n\n__settings__?: {str:any}\n\nname: str\n\nage: int" + "Attributes:\n\nname: str\n\nage: int" ); } } @@ -227,7 +227,7 @@ mod tests { if let MarkedString::String(s) = vec[2].clone() { assert_eq!( s, - "Attributes:\n\n__settings__?: {str:any}\n\nname: str\n\nage?: int" + "Attributes:\n\nname: str\n\nage?: int" ); } } diff --git a/kclvm/tools/src/LSP/src/tests.rs b/kclvm/tools/src/LSP/src/tests.rs index c258c335e..b18207a00 100644 --- a/kclvm/tools/src/LSP/src/tests.rs +++ b/kclvm/tools/src/LSP/src/tests.rs @@ -851,7 +851,7 @@ fn hover_test() { MarkedString::String("__main__\n\nschema Person".to_string()), MarkedString::String("hover doc test".to_string()), MarkedString::String( - "Attributes:\n\n__settings__?: {str:any}\n\nname: str\n\nage?: int".to_string() + "Attributes:\n\nname: str\n\nage?: int".to_string() ), ]), range: None @@ -1225,7 +1225,6 @@ fn konfig_completion_test_main() { "kubevela_output", "server_output", "schedulingStrategy", - "__settings__", "name", "workloadType", "renderType", @@ -1310,7 +1309,7 @@ fn konfig_hover_test_main() { let expect: Vec = vec![ "base.pkg.kusion_models.kube.frontend\n\nschema Server", "Server is abstaction of Deployment and StatefulSet.", - "Attributes:\n\n__settings__?: {str:any}\n\nname?: str\n\nworkloadType: str(Deployment) | str(StatefulSet)\n\nrenderType?: str(Server) | str(KubeVelaApplication)\n\nreplicas: int\n\nimage: str\n\nschedulingStrategy: SchedulingStrategy\n\nmainContainer: Main\n\nsidecarContainers?: [Sidecar]\n\ninitContainers?: [Sidecar]\n\nuseBuiltInLabels?: bool\n\nlabels?: {str:str}\n\nannotations?: {str:str}\n\nuseBuiltInSelector?: bool\n\nselector?: {str:str}\n\npodMetadata?: ObjectMeta\n\nvolumes?: [Volume]\n\nneedNamespace?: bool\n\nenableMonitoring?: bool\n\nconfigMaps?: [ConfigMap]\n\nsecrets?: [Secret]\n\nservices?: [Service]\n\ningresses?: [Ingress]\n\nserviceAccount?: ServiceAccount\n\nstorage?: ObjectStorage\n\ndatabase?: DataBase" + "Attributes:\n\nname?: str\n\nworkloadType: str(Deployment) | str(StatefulSet)\n\nrenderType?: str(Server) | str(KubeVelaApplication)\n\nreplicas: int\n\nimage: str\n\nschedulingStrategy: SchedulingStrategy\n\nmainContainer: Main\n\nsidecarContainers?: [Sidecar]\n\ninitContainers?: [Sidecar]\n\nuseBuiltInLabels?: bool\n\nlabels?: {str:str}\n\nannotations?: {str:str}\n\nuseBuiltInSelector?: bool\n\nselector?: {str:str}\n\npodMetadata?: ObjectMeta\n\nvolumes?: [Volume]\n\nneedNamespace?: bool\n\nenableMonitoring?: bool\n\nconfigMaps?: [ConfigMap]\n\nsecrets?: [Secret]\n\nservices?: [Service]\n\ningresses?: [Ingress]\n\nserviceAccount?: ServiceAccount\n\nstorage?: ObjectStorage\n\ndatabase?: DataBase" ] .iter() .map(|s| MarkedString::String(s.to_string()))