mirror of
				https://github.com/zsh-users/zsh-syntax-highlighting.git
				synced 2025-10-30 15:56:28 +08:00 
			
		
		
		
	Avoid warning under setopt warn_nested_var
Previously in a shell running with `setopt warn_nested_var`, the following warning would be produced: > ``` > _zsh_highlight_main__precmd_hook:1: array parameter _zsh_highlight_main__command_type_cache set in enclosing scope in function _zsh_highlight_main__precmd_hook > ``` The documentation for `WARN_NESTED_VAR` is: > Print a warning message when an existing parameter from an enclosing > function scope, or global, is set in a function by an assignment or in > math context. […] Where possible, use of `typeset -g` to set the parame- > ter suppresses the error, but note that this needs to be used every time > the parameter is set.
This commit is contained in:
		
							parent
							
								
									f1b9fbbaf0
								
							
						
					
					
						commit
						efba5b1220
					
				@ -1677,7 +1677,7 @@ _zsh_highlight_main_highlighter_expand_path()
 | 
				
			|||||||
# -------------------------------------------------------------------------------------------------
 | 
					# -------------------------------------------------------------------------------------------------
 | 
				
			||||||
 | 
					
 | 
				
			||||||
_zsh_highlight_main__precmd_hook() {
 | 
					_zsh_highlight_main__precmd_hook() {
 | 
				
			||||||
  _zsh_highlight_main__command_type_cache=()
 | 
					  typeset -gA _zsh_highlight_main__command_type_cache=()
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
autoload -Uz add-zsh-hook
 | 
					autoload -Uz add-zsh-hook
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user