mirror of
				https://github.com/neovim/neovim.git
				synced 2025-10-26 12:27:24 +00:00 
			
		
		
		
	:checkhealth : validate 'runtimepath' (#7526)
This commit is contained in:
		| @@ -23,11 +23,11 @@ Commands				*health-commands* | ||||
| 					*:checkhealth* *:CheckHealth* | ||||
| :checkhealth          Run all healthchecks. | ||||
| 					*E5009* | ||||
|                       Nvim depends on the |$VIMRUNTIME| environment variable | ||||
|                       to find the standard "runtime files" for syntax | ||||
|                       highlighting, filetype-specific behavior, and standard | ||||
|                       plugins such as :checkhealth.  If $VIMRUNTIME is invalid | ||||
|                       then those features will not work. | ||||
|                       Nvim depends on |$VIMRUNTIME| and 'runtimepath' to find | ||||
|                       the standard "runtime files" for syntax highlighting, | ||||
|                       filetype-specific behavior, and standard plugins | ||||
|                       (including :checkhealth).  If the runtime files cannot | ||||
|                       be found then those features will not work. | ||||
|  | ||||
| :checkhealth {plugins} | ||||
|                       Run healthcheck(s) for one or more plugins. E.g. to run | ||||
|   | ||||
| @@ -22883,11 +22883,15 @@ void ex_checkhealth(exarg_T *eap) | ||||
|     const char *vimruntime_env = os_getenv("VIMRUNTIME"); | ||||
|     if (vimruntime_env == NULL) { | ||||
|       EMSG(_("E5009: $VIMRUNTIME is empty or unset")); | ||||
|       return; | ||||
|     } else { | ||||
|       EMSG2(_("E5009: Invalid $VIMRUNTIME: %s"), os_getenv("VIMRUNTIME")); | ||||
|       return; | ||||
|       bool rtp_ok = NULL != strstr((char *)p_rtp, vimruntime_env); | ||||
|       if (rtp_ok) { | ||||
|         EMSG2(_("E5009: Invalid $VIMRUNTIME: %s"), vimruntime_env); | ||||
|       } else { | ||||
|         EMSG(_("E5009: Invalid 'runtimepath'")); | ||||
|       } | ||||
|     } | ||||
|     return; | ||||
|   } | ||||
|  | ||||
|   size_t bufsize = STRLEN(eap->arg) + sizeof("call health#check('')"); | ||||
|   | ||||
| @@ -16,6 +16,13 @@ describe(':checkhealth', function() | ||||
|     eq(false, status) | ||||
|     eq('Invalid $VIMRUNTIME: bogus', string.match(err, 'Invalid.*')) | ||||
|   end) | ||||
|   it("detects invalid 'runtimepath'", function() | ||||
|     clear() | ||||
|     command('set runtimepath=bogus') | ||||
|     local status, err = pcall(command, 'checkhealth') | ||||
|     eq(false, status) | ||||
|     eq("Invalid 'runtimepath'", string.match(err, 'Invalid.*')) | ||||
|   end) | ||||
|   it("detects invalid $VIM", function() | ||||
|     clear() | ||||
|     -- Do this after startup, otherwise it just breaks $VIMRUNTIME. | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Justin M. Keyes
					Justin M. Keyes