From 7b937d6b71eb069f584c0cc3cb9d6fc0c0f20fdd Mon Sep 17 00:00:00 2001 From: Joseph Atkins-Turkish Date: Fri, 17 Jun 2016 13:44:27 -0700 Subject: [PATCH 1/2] Don't send YCMD requests for comments --- ide/static/ide/js/autocomplete.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ide/static/ide/js/autocomplete.js b/ide/static/ide/js/autocomplete.js index a7f002d6..6f6696ae 100644 --- a/ide/static/ide/js/autocomplete.js +++ b/ide/static/ide/js/autocomplete.js @@ -217,6 +217,9 @@ CloudPebble.Editor.Autocomplete = new (function() { if (!token || (token.string.replace(/[^a-z0-9_]/gi, '').length < 1 && token.string != '.' && token.string != '->')) { return; } + if (token.type == "comment") { + return; + } } catch (e) { return; } From 7dbc3b1c31e2e77da0d409cf6af8d29cc19b2152 Mon Sep 17 00:00:00 2001 From: Joseph Atkins-Turkish Date: Fri, 17 Jun 2016 14:08:03 -0700 Subject: [PATCH 2/2] Don't send requests YCM 'errors' requests for short files. --- ide/static/ide/js/editor.js | 1 + 1 file changed, 1 insertion(+) diff --git a/ide/static/ide/js/editor.js b/ide/static/ide/js/editor.js index ac4498a5..612a8f4f 100644 --- a/ide/static/ide/js/editor.js +++ b/ide/static/ide/js/editor.js @@ -387,6 +387,7 @@ CloudPebble.Editor = (function() { var debounced_check = _.debounce(function() { if(sChecking) return; sChecking = true; + if (code_mirror.getValue().match(/\n/g).length < 5) return; CloudPebble.YCM.request('errors', code_mirror) .then(function(data) { _.each(clang_lines, function(line) {