|
1 |
| -let s:configFileName = 'vim-node-config.json' |
| 1 | +let s:configFileName = 'vim-node-inspect.json' |
| 2 | +let s:legacyConfigFileName = 'vim-node-config.json' |
2 | 3 |
|
3 | 4 | function! s:removeSessionKeys(session,...)
|
4 | 5 | for uvar in a:000
|
@@ -34,20 +35,32 @@ function! s:ReplaceMacros(str)
|
34 | 35 | return replaced
|
35 | 36 | endfunction
|
36 | 37 |
|
| 38 | +function s:getReadableConfigFile(path) |
| 39 | + let configFilePath = a:path . '/' . s:configFileName |
| 40 | + if filereadable(configFilePath) |
| 41 | + return configFilePath |
| 42 | + endif |
| 43 | + let legacyConfigFilePath = a:path . '/' . s:legacyConfigFileName |
| 44 | + if filereadable(legacyConfigFilePath) |
| 45 | + return legacyConfigFilePath |
| 46 | + endif |
| 47 | + return v:false |
| 48 | +endfunction |
| 49 | + |
37 | 50 | " find the config file path. if its not in the currend working directory, try
|
38 | 51 | " going up from the current buffer directory. Returns the directory or empty
|
39 | 52 | " string if failed to find the config file.
|
40 | 53 | function s:GetConfigFilePath()
|
41 |
| - let configFilePath = getcwd() . '/' . s:configFileName |
42 |
| - if filereadable(configFilePath) |
| 54 | + let configFilePath = s:getReadableConfigFile(getcwd()) |
| 55 | + if configFilePath |
43 | 56 | return configFilePath
|
44 | 57 | endif
|
45 | 58 | " if the file is not found in pwd and the script is a decedant, try going up
|
46 | 59 | let expandString = '%:p:h'
|
47 | 60 | let traverseDir = expand(expandString)
|
48 | 61 | while stridx(traverseDir, getcwd()) != -1
|
49 |
| - let configFilePath = traverseDir . '/' . s:configFileName |
50 |
| - if filereadable(configFilePath) |
| 62 | + let configFilePath = s:getReadableConfigFile(traverseDir) |
| 63 | + if configFilePath |
51 | 64 | return configFilePath
|
52 | 65 | endif
|
53 | 66 | let expandString = expandString . ':h'
|
|
0 commit comments