mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 06:02:44 +00:00 
			
		
		
		
	LibGUI: Suggest classes when typing identifiers
We now suggest classes even if the line does not start with an @. After all, we now have fuzzy matching, so why *shouldn't* "color" match @GUI::ColorInput as well as background_color?
This commit is contained in:
		
							parent
							
								
									22a955b2d7
								
							
						
					
					
						commit
						d73d044f2b
					
				
					 1 changed files with 12 additions and 3 deletions
				
			
		|  | @ -184,15 +184,24 @@ void GMLAutocompleteProvider::provide_completions(Function<void(Vector<Entry>)> | |||
|         break; | ||||
|     } | ||||
|     case InIdentifier: { | ||||
|         if (class_names.is_empty()) | ||||
|             break; | ||||
|         if (last_seen_token && last_seen_token->m_end.column != cursor.column() && last_seen_token->m_end.line == cursor.line()) { | ||||
|             // After an identifier, but with extra space
 | ||||
|             // TODO: Maybe suggest a colon?
 | ||||
|             break; | ||||
|         } | ||||
| 
 | ||||
|         register_class_properties_matching_pattern(make_fuzzy(identifier_string), identifier_string.length()); | ||||
|         auto fuzzy_pattern = make_fuzzy(identifier_string); | ||||
|         if (!class_names.is_empty()) { | ||||
|             register_class_properties_matching_pattern(fuzzy_pattern, identifier_string.length()); | ||||
| 
 | ||||
|             auto parent_registration = Core::ObjectClassRegistration::find(class_names.last()); | ||||
|             if (parent_registration && parent_registration->is_derived_from(layout_class)) { | ||||
|                 // Layouts can't have child classes, so why suggest them?
 | ||||
|                 break; | ||||
|             } | ||||
|         } | ||||
| 
 | ||||
|         register_widgets_matching_pattern(fuzzy_pattern, identifier_string.length()); | ||||
|         break; | ||||
|     } | ||||
|     case AfterClassName: { | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 thislooksfun
						thislooksfun