File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed
Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change 270270 "type" : " boolean" ,
271271 "default" : true ,
272272 "description" : " Whether to automatically remove `cocos2d::` from included code"
273+ },
274+ "geode.modifyClassSuggestions.addOverrideMacro" : {
275+ "type" : " boolean" ,
276+ "default" : false ,
277+ "description" : " Add $override to the beginning of the included code"
273278 }
274279 }
275280 },
Original file line number Diff line number Diff line change @@ -65,11 +65,15 @@ export class ModifyClassMethodCompletion implements CompletionItemProvider {
6565 const stripCocos = getExtConfig ( ) . get < boolean > (
6666 "modifyClassSuggestions.stripCocosNamespace" ,
6767 ) ;
68+ const addOverrideMacro = getExtConfig ( ) . get < boolean > (
69+ "modifyClassSuggestions.addOverrideMacro" ,
70+ ) ;
6871
6972 let suggestions = [ ] ;
7073 for ( let func of classInfo . functions ) {
7174 const shortFuncDecl = `${ func . name } (${ func . args . map ( ( a ) => `${ a . type } ${ a . name } ` ) . join ( ", " ) } )` ;
72- const fullFuncDecl = `${ func . static ? "static " : "" } ${ func . return } ${ shortFuncDecl } ` . trimStart ( ) ;
75+ const fullFuncDecl =
76+ `${ func . static ? "static " : "" } ${ func . return } ${ shortFuncDecl } ` . trimStart ( ) ;
7377 const origCall = `${ currentClass } ::${ func . name } (${ func . args . map ( ( a ) => a . name ) . join ( ", " ) } )` ;
7478
7579 let origStatement ;
@@ -92,6 +96,9 @@ export class ModifyClassMethodCompletion implements CompletionItemProvider {
9296 if ( func . kind === "ctor" || func . kind === "dtor" ) {
9397 item . insertText = `void ${ func . kind === "ctor" ? "constructor" : "destructor" } () {\n\t${ origStatement } \n}` ;
9498 }
99+ if ( addOverrideMacro ) {
100+ item . insertText = `\\$override\n${ item . insertText } ` ;
101+ }
95102 if ( stripCocos ) {
96103 item . insertText = item . insertText . replace ( / c o c o s 2 d : : / g, "" ) ;
97104 }
You can’t perform that action at this time.
0 commit comments