From 8f7a07e9df6c2e9c538467bfa7add267d57639b8 Mon Sep 17 00:00:00 2001 From: Zhao Cai Date: Tue, 23 Aug 2016 20:17:47 -0400 Subject: [PATCH 1/8] Use * if to enable all filetypes. --- lib/config.coffee | 1 + lib/utility.coffee | 2 ++ 2 files changed, 3 insertions(+) diff --git a/lib/config.coffee b/lib/config.coffee index 58001f5..0ca696d 100644 --- a/lib/config.coffee +++ b/lib/config.coffee @@ -22,6 +22,7 @@ module.exports = description: ' An array of filetypes within we should provide completions and diagnostics. They are equivalent to file extensions most of the time. + Use * if you want to enable all filetypes. ' linterEnabled: type: 'boolean' diff --git a/lib/utility.coffee b/lib/utility.coffee index 610790a..c962c5a 100644 --- a/lib/utility.coffee +++ b/lib/utility.coffee @@ -58,6 +58,8 @@ buildRequestParameters = (filepath, contents, filetypes = [], bufferPosition = n isEnabledForScope = (scopeDescriptor) -> enabledFiletypes = atom.config.get 'you-complete-me.enabledFiletypes' + if enabledFiletypes.indexOf('*') + return true filetypes = getScopeFiletypes scopeDescriptor filetype = filetypes.find (filetype) -> enabledFiletypes.indexOf(filetype) >= 0 return if filetype? then true else false From 31e102abed9b310e97499b52d1d136d5ee9c7bdb Mon Sep 17 00:00:00 2001 From: Zhao Cai Date: Mon, 12 Sep 2016 06:38:49 -0400 Subject: [PATCH 2/8] Set tag_files parameter for ycmd --- lib/utility.coffee | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/utility.coffee b/lib/utility.coffee index c962c5a..4ddaace 100644 --- a/lib/utility.coffee +++ b/lib/utility.coffee @@ -44,6 +44,7 @@ buildRequestParameters = (filepath, contents, filetypes = [], bufferPosition = n line_num: bufferPosition.row + 1 column_num: bufferPosition.column + 1 file_data: {} + tag_files: ['.tags', 'tags'].map (t) -> path.join(workingDir, t) parameters.file_data[filepath] = {contents, filetypes: convertFiletypes filetypes} atom.workspace.getTextEditors() .filter (editor) -> From d16797032d032723a7f95c2aa324c83bcba0545f Mon Sep 17 00:00:00 2001 From: Zhao Cai Date: Mon, 12 Sep 2016 09:42:39 -0400 Subject: [PATCH 3/8] Fix suggestion type --- lib/get-completions.coffee | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/get-completions.coffee b/lib/get-completions.coffee index 9af33d5..eac5d23 100644 --- a/lib/get-completions.coffee +++ b/lib/get-completions.coffee @@ -27,11 +27,12 @@ convertCompletions = ({completions, prefix, filetypes}) -> text: completion.insertion_text replacementPrefix: prefix displayText: completion.menu_text - leftLabel: completion.extra_menu_info + leftLabel: completion.extra_menu_info.replace(/(^\[|\]$)/g, '') rightLabel: completion.kind description: completion.detailed_info - suggestion.type = switch completion.kind + suggestion.type = switch completion.extra_menu_info when '[File]', '[Dir]', '[File&Dir]' then 'import' + when '[ID]' then 'keyword' else null return suggestion From b72c6b57b11842d5c8d3d24db3e4ea0f77e9452d Mon Sep 17 00:00:00 2001 From: Zhao Cai Date: Mon, 12 Sep 2016 18:50:02 -0400 Subject: [PATCH 4/8] Add filetype map for ahk --- lib/utility.coffee | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/utility.coffee b/lib/utility.coffee index 4ddaace..d887636 100644 --- a/lib/utility.coffee +++ b/lib/utility.coffee @@ -35,6 +35,7 @@ buildRequestParameters = (filepath, contents, filetypes = [], bufferPosition = n convertFiletypes = (filetypes) -> filetypes.map((filetype) -> switch filetype when 'js', 'jsx' then 'javascript' + when 'ahk' then 'autohotkey' else filetype ).filter (filetype, index, filetypes) -> filetypes.indexOf(filetype) is index workingDir = getWorkingDirectory() From a8af28de88918a2011d5c36fe7fc0e868a69f48d Mon Sep 17 00:00:00 2001 From: Zhao Cai Date: Mon, 12 Sep 2016 18:51:41 -0400 Subject: [PATCH 5/8] Remove * filetype --- lib/config.coffee | 1 - lib/utility.coffee | 2 -- 2 files changed, 3 deletions(-) diff --git a/lib/config.coffee b/lib/config.coffee index 0ca696d..58001f5 100644 --- a/lib/config.coffee +++ b/lib/config.coffee @@ -22,7 +22,6 @@ module.exports = description: ' An array of filetypes within we should provide completions and diagnostics. They are equivalent to file extensions most of the time. - Use * if you want to enable all filetypes. ' linterEnabled: type: 'boolean' diff --git a/lib/utility.coffee b/lib/utility.coffee index d887636..9aa9a3e 100644 --- a/lib/utility.coffee +++ b/lib/utility.coffee @@ -60,8 +60,6 @@ buildRequestParameters = (filepath, contents, filetypes = [], bufferPosition = n isEnabledForScope = (scopeDescriptor) -> enabledFiletypes = atom.config.get 'you-complete-me.enabledFiletypes' - if enabledFiletypes.indexOf('*') - return true filetypes = getScopeFiletypes scopeDescriptor filetype = filetypes.find (filetype) -> enabledFiletypes.indexOf(filetype) >= 0 return if filetype? then true else false From 9fe97e35c6e553f783e6e14ae9eac4a05d7902e6 Mon Sep 17 00:00:00 2001 From: Zhao Cai Date: Tue, 13 Sep 2016 02:21:09 -0400 Subject: [PATCH 6/8] Add config for custom ycmd default_settings.json --- lib/config.coffee | 20 ++++++++++++++------ lib/handler.coffee | 7 +++++-- 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/lib/config.coffee b/lib/config.coffee index 58001f5..1880dd9 100644 --- a/lib/config.coffee +++ b/lib/config.coffee @@ -14,11 +14,19 @@ module.exports = The directory containing the `ycmd/default_settings.json` file. [Ycmd](https://github.com/Valloric/ycmd) is required for this plugin to work. ' + ycmdSettingPath: + type: 'string' + default: 'ycmd/default_settings.json' + order: 3 + description: ' + The `default_settings.json` to start ycmd server. + Copy the `ycmd/default_settings.json` file and modify as needed. + ' enabledFiletypes: type: 'array' items: type: 'string' default: ['c', 'cpp', 'objc', 'objcpp'] - order: 3 + order: 4 description: ' An array of filetypes within we should provide completions and diagnostics. They are equivalent to file extensions most of the time. @@ -26,14 +34,14 @@ module.exports = linterEnabled: type: 'boolean' default: true - order: 4 + order: 5 description: ' Disable linter if you do not need those diagnostic messages. ' globalExtraConfig: type: 'string' default: '' - order: 5 + order: 6 description: ' The fallback extra config file when no `.ycm_extra_conf.py` is found. Follow [this link](https://github.com/Valloric/YouCompleteMe#the-gycm_global_ycm_extra_conf-option) for more information. @@ -41,7 +49,7 @@ module.exports = confirmExtraConfig: type: 'boolean' default: true - order: 6 + order: 7 description: ' Whether to ask once before loading an extra config file for safety reason. To selectively whitelist or blacklist them, use **Extra Config Globlist** option. @@ -51,7 +59,7 @@ module.exports = type: 'array' items: type: 'string' default: [] - order: 7 + order: 8 description: ' Extra config files whitelist and blacklist, e.g. `~/dev/*, !~/*` would make it load all `.ycm_extra_conf.py` under `~/dev/` and not to load all other `.ycm_extra_conf.py` under `~/`, without confirmation. @@ -60,7 +68,7 @@ module.exports = rustSrcPath: type: 'string' default: '' - order: 8 + order: 9 description: ' The directory containing the [Rust source code](https://github.com/rust-lang/rust). You have also to to add `rust` in **Enabled Filetypes**. diff --git a/lib/handler.coffee b/lib/handler.coffee index d7f71f1..83f4349 100644 --- a/lib/handler.coffee +++ b/lib/handler.coffee @@ -33,8 +33,11 @@ launch = (exit) -> reject error readDefaultOptions = new Promise (fulfill, reject) -> - defaultOptionsFile = path.resolve atom.config.get('you-complete-me.ycmdPath'), 'ycmd', 'default_settings.json' - fs.readFile defaultOptionsFile, encoding: 'utf8', (error, data) -> + customOptionsFile = path.resolve atom.config.get('you-complete-me.ycmdSettingPath') + fs.exists customOptionsFile, (exists) -> + unless exists? + customOptionsFile = path.resolve atom.config.get('you-complete-me.ycmdPath'), 'ycmd', 'default_settings.json' + fs.readFile customOptionsFile, encoding: 'utf8', (error, data) -> unless error? fulfill JSON.parse data else From 7ab23153e1bc6504885ae55d5d29af2feb76f650 Mon Sep 17 00:00:00 2001 From: Zhao Cai Date: Tue, 25 Oct 2016 09:58:33 -0400 Subject: [PATCH 7/8] Use tag typename for youcompleteme ID --- lib/get-completions.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/get-completions.coffee b/lib/get-completions.coffee index 136ce37..b0a22de 100644 --- a/lib/get-completions.coffee +++ b/lib/get-completions.coffee @@ -32,7 +32,7 @@ convertCompletions = ({completions, prefix, filetypes}) -> description: completion.detailed_info suggestion.type = switch completion.extra_menu_info when '[File]', '[Dir]', '[File&Dir]' then 'import' - when '[ID]' then 'keyword' + when '[ID]' then 'tag' else null return suggestion From b9e4d1c7311436f5a76e390d2d0a55b4d33deb84 Mon Sep 17 00:00:00 2001 From: Zhao Cai Date: Tue, 25 Oct 2016 09:59:40 -0400 Subject: [PATCH 8/8] Reduce Priority (lower than autocomplete-snippets) --- lib/provider.coffee | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/provider.coffee b/lib/provider.coffee index 370acfe..bbf751f 100644 --- a/lib/provider.coffee +++ b/lib/provider.coffee @@ -5,8 +5,8 @@ command = require './command' module.exports = selector: '*' - inclusionPriority: 2 - suggestionPriority: 2 + inclusionPriority: 0 + suggestionPriority: 1 excludeLowerPriority: false grammarScopes: ['*']