@@ -17,9 +17,37 @@ import type {
1717import type { BaseLogger } from "../../common/logging" ;
1818import type { AccessPathSuggestionRow } from "../suggestions" ;
1919
20+ // This is a subset of the model config that doesn't import the vscode module.
21+ // It only includes settings that are actually used.
22+ export type ModelConfig = {
23+ showTypeModels : boolean ;
24+ } ;
25+
26+ /**
27+ * This function creates a new model config object from the given model config object.
28+ * The new model config object is a deep copy of the given model config object.
29+ *
30+ * @param modelConfig The model config object to create a new model config object from.
31+ * In most cases, this is a `ModelConfigListener`.
32+ */
33+ export function createModelConfig ( modelConfig : ModelConfig ) : ModelConfig {
34+ return {
35+ showTypeModels : modelConfig . showTypeModels ,
36+ } ;
37+ }
38+
39+ export const defaultModelConfig : ModelConfig = {
40+ showTypeModels : false ,
41+ } ;
42+
2043type GenerateMethodDefinition < T > = ( method : T ) => DataTuple [ ] ;
2144type ReadModeledMethod = ( row : DataTuple [ ] ) => ModeledMethod ;
2245
46+ type IsHiddenContext = {
47+ method : MethodDefinition ;
48+ config : ModelConfig ;
49+ } ;
50+
2351export type ModelsAsDataLanguagePredicate < T > = {
2452 extensiblePredicate : string ;
2553 supportedKinds ?: string [ ] ;
@@ -30,6 +58,14 @@ export type ModelsAsDataLanguagePredicate<T> = {
3058 supportedEndpointTypes ?: EndpointType [ ] ;
3159 generateMethodDefinition : GenerateMethodDefinition < T > ;
3260 readModeledMethod : ReadModeledMethod ;
61+
62+ /**
63+ * Controls whether this predicate is hidden for a certain method. This only applies to the UI.
64+ * If not specified, the predicate is visible for all methods.
65+ *
66+ * @param method The method to check if the predicate is hidden for.
67+ */
68+ isHidden ?: ( context : IsHiddenContext ) => boolean ;
3369} ;
3470
3571export type GenerationContext = {
0 commit comments