Accéder au contenu principal

VSCODE: change all occurence quickly one write






as you can see, we can use the shortcut CTRL+F2  (make sure there is now other program using that shortcut, you can change that or add another keybinding too)


How it work? => we select a word, then CTRL+F2 then all the occurrence get automatically selected and so we will get a cursor at each occurrence. if we start writing, we write over each occurence

Commentaires

Posts les plus consultés de ce blog

Visual Studio Code: Formate and beautify PHP files and Laravel blade files with HTML markup on them (Formate the HTML)

The extension beautify just do it very well, either add php and any other file extension type to the config as said above here is an example : go to user settings (CTRL + comma) search for beautify in the field above, and identify the line beautify.language, then click left in the pencil icon and click replace in settings. It will add the config to the right (user settings). for html section just add php and blade.php OTHERWISE: you can also do it directly , type F1 then write beautify , the auto completion give you two choices beautify selection or beautify file . Choose the one you need , and it will do the job. that's a straight direct way . You can also add a keybinding to have a keyboard shortcut , here how to do it: open keybindings.json (go file>preferences>keyboard shortcuts ) click in above open and edit keybindings.json add the following into the closed brackets [] { "key": "alt+b", "command"...

Python: dictionary, keys and testing if a key exist

 get() methode for retrieval (no exception): Using get() methode there is no need to handle any exception return the value if exist, None if not. ex: dic = { 'key1' : 'value1' } dic.get( 'key1' ) # out: 'value1' dict.get( 'key2' ) # out: None ====> you can specify a second argument, a value to be returned in case the key don't exist ex:  aValue = "i'm the replacement" dic.get('key2',aValue)  # out:  i'm the replacement  Test if a key exist: We use if [] in [] :   key = "key2"   if key in dictionary :         print("key exist")   else:         print("key Don't exist")