richard1122 / vscode-youcompleteme

YouCompleteMe for VSCode
https://marketplace.visualstudio.com/items?itemName=RichardHe.you-complete-me
MIT License
53 stars 8 forks source link

The ycm-language-server server crashed 5 times in the last 3 minutes #14

Closed agauniyal closed 7 years ago

agauniyal commented 8 years ago
The ycm-language-server server crashed 5 times in the last 3 minutes.
The server will not be restarted.

Latest ycmd, works good with vim but crashes everytime with vscode πŸ˜•

agauniyal commented 8 years ago

I've narrowed down this behaviour to opening a new vscode instance with already opened files from last session. For example if I've 5-6 cpp files opened from last session and I close and reopen vscode, those 5-6 files would be opened up in separate tabs and this plugin crashes.

eedahl commented 8 years ago

I have this problem too.

richard1122 commented 8 years ago

I've tested many times and could not reproduce this problem. Could you provide more information?

agauniyal commented 8 years ago

@richard1122 create some .hpp files and some .cpp files. The source files should include those header files. Keep them open in different tabs in vscode and then close the vscode window. Next time vscode opens up, it'll restore the tabs as they were opened before and plugin crashes.

richard1122 commented 8 years ago

Hi, I tested on both VSCode and VSCode Insider Builds, both works fine. I have two .hpp files, each of them with one class definition, five .cpp files include both .hpp.

magengbin commented 7 years ago

I have this problem too. win10

magengbin commented 7 years ago

events.js:160 throw er; // Unhandled 'error' event ^

Error: connect ECONNREFUSED 127.0.0.1:5092 at Object.exports._errnoException (util.js:1026:11) at exports._exceptionWithHostPort (util.js:1049:20) at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1081:14) [Info - 上午9:59:11] Connection to server got closed. Server will restart. events.js:160 throw er; // Unhandled 'error' event ^

Error: connect ECONNREFUSED 127.0.0.1:5096 at Object.exports._errnoException (util.js:1026:11) at exports._exceptionWithHostPort (util.js:1049:20) at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1081:14) [Error - 上午9:59:15] Connection to server got closed. Server will not be restarted.

agauniyal commented 7 years ago

I'm on linux so it clears down issue related to choice of OS.

SneWs commented 7 years ago

Have this as well on both Linux and OS X. Works fine in Vim as mentioned before. Could this issue be attributed to improper HMAC handling in the VSCode plugin @richard1122 ?

agauniyal commented 7 years ago

I'll try to debug this and provide more information today.

agauniyal commented 7 years ago

@richard1122 could you tell me how to build this plugin and start debugging. I went to server directory and debugged it, it says - "outDir": "${workspaceRoot}/../client/server" does not exist. I went to client directory and debugged it, again failed with some other errors..

This bug is very irritating since we need to restart vscode again and again and each time kill all the 5 ycmd processes it spawned, so I'll try to provide any sort of help you need.

richard1122 commented 7 years ago

@agauniyal There're two part of this plugin: client and server.

First I suppose you are using vscode to build this.

  1. Open both client and server folder with vscode.
  2. Press ctrl+b in both workspaces to start compiling and watching.
  3. In client workspace, press F5 to start extension development workspace. This workspace will load the plugin you currently working on.
richard1122 commented 7 years ago

@agauniyal Here is a travis script to show how to build and package an extension.

https://github.com/richard1122/vscode-youcompleteme/blob/master/.travis.yml

agauniyal commented 7 years ago

@richard1122 Request evaluate was canceled because nodejs was unresponsive, this occurred multiple times for me.. rest is working fine but idk why that bug happens..

Edit - Maybe I get it, this happens when vscode launches server and client at same time and client isn't ready to be yet connect with server. This is absolutely reproducible if you press F5 multiple times successively on server instance of vscode after launching client instance. The first few times will give - Cannot connect to runtime process, reason: GETADDRINFO EMFILE undefined:6004

If you can control server instance launch, probably put 2-3 seconds delay before launching it?

richard1122 commented 7 years ago

@agauniyal I'm not sure whether this is what the problem is.

The plugin server is NOT launched by your server workspace. The plugin itself starts server wrapped in. This is done by vscode-language-server-node.

Current version of vscode-language-server-node sdk will not send any request until initialize finished. see here

I guess this might related to here.

findUnusedPort first, and then listen on it.

I'll try to delay server starts up and see whether it helps later today.

agauniyal commented 7 years ago

@richard1122 Here are some more debug logs -

[onDidChangeConfiguration settings] {"ycmd":{"confirm_extra_conf":true,"debug":true,"enabled_languages":["cpp","c"],"global_extra_config":"/home/agauniyal/.vim/.ycm_extra_conf.py","path":"/home/agauniyal/.vim/plugged/YouCompleteMe/third_party/ycmd","python":"/usr/bin/python2","use_imprecise_get_type":true}}
[getInstance] ycm is restarting
[onDidOpen] file:///home/agauniyal/projects/rang/include/rang.hpp
[getInstance] ycm is initializing, delay 200ms...
[onDidChangeContent "file:///home/agauniyal/projects/rang/include/rang.hpp"]
[getInstance] ycm is initializing, delay 200ms...
[onCodeAction] {"textDocument":{"uri":"file:///home/agauniyal/projects/rang/include/rang.hpp"},"range":{"start":{"line":8,"character":8},"end":{"line":8,"character":14}},"context":{"diagnostics":[]}}
[getInstance] ycm is initializing, delay 200ms...
[start] unused port: 45741
[start] random secret: fb5ec6a69c092b8b2b421ee034e4185a
[start] default options: {"filepath_completion_use_working_dir":0,"auto_trigger":1,"min_num_of_chars_for_completion":2,"min_num_identifier_candidate_chars":0,"semantic_triggers":{},"filetype_specific_completion_to_disable":{"gitcommit":1},"seed_identifiers_with_syntax":0,"collect_identifiers_from_comments_and_strings":0,"collect_identifiers_from_tags_files":0,"max_num_identifier_candidates":10,"extra_conf_globlist":[],"global_ycm_extra_conf":"","confirm_extra_conf":1,"complete_in_comments":0,"complete_in_strings":1,"max_diagnostics_to_display":30,"filetype_whitelist":{"*":1},"filetype_blacklist":{"tagbar":1,"qf":1,"notes":1,"markdown":1,"netrw":1,"unite":1,"text":1,"vimwiki":1,"pandoc":1,"infolog":1,"mail":1},"auto_start_csharp_server":1,"auto_stop_csharp_server":1,"use_ultisnips_completer":1,"csharp_server_port":0,"hmac_secret":"","server_keep_logfiles":0,"gocode_binary_path":"","godef_binary_path":"","rust_src_path":"","racerd_binary_path":"","python_binary_path":""}
[processData: {"filepath_completion_use_working_dir":0,"auto_trigger":1,"min_num_of_chars_for_completion":2,"min_num_identifier_candidate_chars":0,"semantic_triggers":{},"filetype_specific_completion_to_disable":{"gitcommit":1},"seed_identifiers_with_syntax":0,"collect_identifiers_from_comments_and_strings":0,"collect_identifiers_from_tags_files":0,"max_num_identifier_candidates":10,"extra_conf_globlist":[],"global_ycm_extra_conf":"/home/agauniyal/.vim/.ycm_extra_conf.py","confirm_extra_conf":true,"complete_in_comments":0,"complete_in_strings":1,"max_diagnostics_to_display":30,"filetype_whitelist":{"*":1},"filetype_blacklist":{"tagbar":1,"qf":1,"notes":1,"markdown":1,"netrw":1,"unite":1,"text":1,"vimwiki":1,"pandoc":1,"infolog":1,"mail":1},"auto_start_csharp_server":1,"auto_stop_csharp_server":1,"use_ultisnips_completer":1,"csharp_server_port":0,"hmac_secret":"+17GppwJK4srQh7gNOQYWg==","server_keep_logfiles":0,"gocode_binary_path":"","godef_binary_path":"","rust_src_path":"","racerd_binary_path":"","python_binary_path":"","rustSrcPath":""}]
[start] optionsFile: /tmp/VSCodeYcmOptions-1489217498965
[_start] [ '/home/agauniyal/.vim/plugged/YouCompleteMe/third_party/ycmd/ycmd',
  '--port=45741',
  '--options_file=/tmp/VSCodeYcmOptions-1489217498965',
  '--idle_suicide_seconds=600' ]
[_start] process spawn success 3901
[getInstance] ycm is initializing, delay 200ms...
[getInstance] ycm is initializing, delay 200ms...
[getInstance] ycm is initializing, delay 200ms...
[getInstance] ycm is initializing, delay 200ms...
[getInstance] ycm is initializing, delay 200ms...
[getInstance] ycm is initializing, delay 200ms...
[getInstance] ycm is initializing, delay 200ms...
[getInstance] ycm is initializing, delay 200ms...
[getInstance] ycm is initializing, delay 200ms...
[getInstance] ycm is initializing, delay 200ms...
[getInstance] ycm is initializing, delay 200ms...
[getInstance] ycm is initializing, delay 200ms...
[getInstance] ycm is initializing, delay 200ms...
[getInstance] ycm is initializing, delay 200ms...
[getInstance] ycm is initializing, delay 200ms...
[start] ycm started: 3901
[buildRequest] document, /home/agauniyal/projects/rang/include/rang.hpp; position: null; event: BufferVisit
[_request] {"filepath":"/home/agauniyal/projects/rang/include/rang.hpp","working_dir":"/home/agauniyal/projects/rang","file_data":{"/home/agauniyal/projects/rang/include/rang.hpp":{"contents":"#ifndef RANG_DOT_HPP\n#define RANG_DOT_HPP\n\n#if defined(__unix__) || defined(__unix) || defined(__linux__)\n#define OS_LINUX\n#elif defined(WIN32) || defined(_WIN32) || defined(_WIN64)\n#define OS_WIN\n#elif defined(__APPLE__) || defined(__MACH__)\n#define OS_MAC\n#else\n#error Unknown Platform\n#endif\n\n#if defined(OS_LINUX) || defined(OS_MAC)\n#include <unistd.h>\n#include <cstring>\n#elif defined(OS_WIN)\n#include <windows.h>\n#include <io.h>\n#include <VersionHelpers.h>\n#endif\n\n#include <algorithm>\n#include <cstdlib>\n#include <ios>\n#include <iostream>\n#include <iterator>\n#include <type_traits>\n#include <atomic>\n\nnamespace rang {\n\nenum class style {\n\treset     = 0,\n\tbold      = 1,\n\tdim       = 2,\n\titalic    = 3,\n\tunderline = 4,\n\tblink     = 5,\n\trblink    = 6,\n\treversed  = 7,\n\tconceal   = 8,\n\tcrossed   = 9\n};\n\nenum class fg {\n\tblack   = 30,\n\tred     = 31,\n\tgreen   = 32,\n\tyellow  = 33,\n\tblue    = 34,\n\tmagenta = 35,\n\tcyan    = 36,\n\tgray    = 37,\n\treset   = 39\n};\n\nenum class bg {\n\tblack   = 40,\n\tred     = 41,\n\tgreen   = 42,\n\tyellow  = 43,\n\tblue    = 44,\n\tmagenta = 45,\n\tcyan    = 46,\n\tgray    = 47,\n\treset   = 49\n};\n\nenum class fgB {\n\tblack   = 90,\n\tred     = 91,\n\tgreen   = 92,\n\tyellow  = 93,\n\tblue    = 94,\n\tmagenta = 95,\n\tcyan    = 96,\n\tgray    = 97\n};\n\nenum class bgB {\n\tblack   = 100,\n\tred     = 101,\n\tgreen   = 102,\n\tyellow  = 103,\n\tblue    = 104,\n\tmagenta = 105,\n\tcyan    = 106,\n\tgray    = 107\n};\n\nenum class control { offColor = 0, autoColor = 1, forceColor = 2 };\n\n\nnamespace rang_implementation {\n\n\n\tinline std::streambuf const *&RANG_coutbuf()\n\t{\n\t\tstatic std::streambuf const *pOutbuff = std::cout.rdbuf();\n\t\treturn pOutbuff;\n\t}\n\n\tinline std::streambuf const *&RANG_cerrbuf()\n\t{\n\t\tstatic std::streambuf const *pErrbuff = std::cerr.rdbuf();\n\t\treturn pErrbuff;\n\t}\n\n\tinline std::streambuf const *&RANG_clogbuf()\n\t{\n\t\tstatic std::streambuf const *pLogbuff = std::clog.rdbuf();\n\t\treturn pLogbuff;\n\t}\n\n\n\tinline std::atomic<int> &controlValue()\n\t{\n\t\tstatic std::atomic<int> value(1);\n\t\treturn value;\n\t}\n\n\n\tinline bool supportsColor()\n\t{\n#if defined(OS_LINUX) || defined(OS_MAC)\n\t\tstatic constexpr const char *Terms[] = {\n\t\t\t\"ansi\", \"color\", \"console\", \"cygwin\", \"gnome\", \"konsole\", \"kterm\",\n\t\t\t\"linux\", \"msys\", \"putty\", \"rxvt\", \"screen\", \"vt100\", \"xterm\"\n\t\t};\n\n\t\tstatic const char *env_p = std::getenv(\"TERM\");\n\n\t\tstatic const bool result = (env_p == nullptr)\n\t\t  ? false\n\t\t  : std::any_of(\n\t\t      std::begin(Terms), std::end(Terms), [](const char *term) {\n\t\t\t      return std::strstr(env_p, term) != nullptr;\n\t\t\t  });\n\n#elif defined(OS_WIN)\n\t\tstatic constexpr bool result = true;\n#endif\n\t\treturn result;\n\t}\n\n\n\tinline bool isTerminal(const std::streambuf *osbuf)\n\t{\n\t\tif (osbuf == RANG_coutbuf()) {\n#if defined(OS_LINUX) || defined(OS_MAC)\n\t\t\treturn isatty(fileno(stdout)) ? true : false;\n#elif defined(OS_WIN)\n\t\t\treturn _isatty(_fileno(stdout)) ? true : false;\n#endif\n\t\t}\n\n\t\tif (osbuf == RANG_cerrbuf() || osbuf == RANG_clogbuf()) {\n#if defined(OS_LINUX) || defined(OS_MAC)\n\t\t\treturn isatty(fileno(stderr)) ? true : false;\n#elif defined(OS_WIN)\n\t\t\treturn _isatty(_fileno(stderr)) ? true : false;\n#endif\n\t\t}\n\t\treturn false;\n\t}\n\n\n\ttemplate <typename T>\n\tusing enableStd =\n\t  typename std::enable_if<std::is_same<T, rang::style>::value\n\t      || std::is_same<T, rang::fg>::value\n\t      || std::is_same<T, rang::bg>::value\n\t      || std::is_same<T, rang::fgB>::value\n\t      || std::is_same<T, rang::bgB>::value,\n\t    std::ostream &>::type;\n\n\n#ifdef OS_WIN\n\tHANDLE getVersionDependentHandle()\n\t{\n\t\tif (IsWindowsVersionOrGreater(10, 0, 0)) return nullptr;\n\t\treturn GetStdHandle(STD_OUTPUT_HANDLE);\n\t}\n\n\tinline HANDLE getConsoleHandle()\n\t{\n\t\tstatic HANDLE h = getVersionDependentHandle();\n\t\treturn h;\n\t}\n\n\tinline WORD reverseRGB(WORD rgb)\n\t{\n\t\tstatic const WORD rev[8] = { 0, 4, 2, 6, 1, 5, 3, 7 };\n\t\treturn rev[rgb];\n\t}\n\n\tinline void setWinAttribute(rang::bg col, WORD &state)\n\t{\n\t\tstate &= 0xFF0F;\n\t\tstate |= reverseRGB(static_cast<WORD>(col) - 40) << 4;\n\t}\n\n\tinline void setWinAttribute(rang::fg col, WORD &state)\n\t{\n\t\tstate &= 0xFFF0;\n\t\tstate |= reverseRGB(static_cast<WORD>(col) - 30);\n\t}\n\n\tinline void setWinAttribute(rang::bgB col, WORD &state)\n\t{\n\t\tstate &= 0xFF0F;\n\t\tstate |= (0x8 | reverseRGB(static_cast<WORD>(col) - 100)) << 4;\n\t}\n\n\tinline void setWinAttribute(rang::fgB col, WORD &state)\n\t{\n\t\tstate &= 0xFFF0;\n\t\tstate |= (0x8 | reverseRGB(static_cast<WORD>(col) - 90));\n\t}\n\n\tinline void setWinAttribute(rang::style style, WORD &state)\n\t{\n\t\tif (style == rang::style::reset) {\n\t\t\tstate = (FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED);\n\t\t}\n\t}\n\n\tinline WORD &current_state()\n\t{\n\t\tstatic WORD state\n\t\t  = (FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED);\n\t\treturn state;\n\t}\n\n\n\ttemplate <typename T>\n\tinline enableStd<T> setColor(std::ostream &os, T const value)\n\t{\n\t\tHANDLE h = getConsoleHandle();\n\t\tif (h && isTerminal(os.rdbuf())) {\n\t\t\tsetWinAttribute(value, current_state());\n\t\t\tSetConsoleTextAttribute(h, current_state());\n\t\t\treturn os;\n\t\t}\n\t\treturn os << \"\\033[\" << static_cast<int>(value) << \"m\";\n\t}\n#else\n\ttemplate <typename T>\n\tinline enableStd<T> setColor(std::ostream &os, T const value)\n\t{\n\t\treturn os << \"\\033[\" << static_cast<int>(value) << \"m\";\n\t}\n#endif\n\n\ttemplate <typename T>\n\tusing enableControl =\n\t  typename std::enable_if<std::is_same<T, rang::control>::value,\n\t    std::ostream &>::type;\n}\n\n\nvoid init()\n{\n\trang_implementation::RANG_coutbuf();\n\trang_implementation::RANG_cerrbuf();\n\trang_implementation::RANG_clogbuf();\n}\n\n\ntemplate <typename T>\ninline rang_implementation::enableStd<T> operator<<(\n  std::ostream &os, T const value)\n{\n\tconst int option = rang_implementation::controlValue();\n\tswitch (option) {\n\t\tcase 0: return os;\n\t\tcase 1:\n\t\t\treturn rang_implementation::supportsColor()\n\t\t\t    && rang_implementation::isTerminal(os.rdbuf())\n\t\t\t  ? rang_implementation::setColor(os, value)\n\t\t\t  : os;\n\t\tcase 2: return rang_implementation::setColor(os, value);\n\t\tdefault: return os;\n\t}\n}\n\n\ntemplate <typename T>\ninline rang_implementation::enableControl<T> operator<<(\n  std::ostream &os, T const value)\n{\n\tif (value == rang::control::offColor) {\n\t\trang_implementation::controlValue() = 0;\n\t} else if (value == rang::control::autoColor) {\n\t\trang_implementation::controlValue() = 1;\n\t} else if (value == rang::control::forceColor) {\n\t\trang_implementation::controlValue() = 2;\n\t}\n\treturn os;\n}\n}\n\n#undef OS_LINUX\n#undef OS_WIN\n#undef OS_MAC\n\n#endif /* ifndef RANG_DOT_HPP */\n","filetypes":["cpp"]}},"line_num":1,"column_num":1,"event_name":"BufferVisit"}
[buildRequest] document, /home/agauniyal/projects/rang/include/rang.hpp; position: [object Object]; event: null
[_request] {"filepath":"/home/agauniyal/projects/rang/include/rang.hpp","working_dir":"/home/agauniyal/projects/rang","file_data":{"/home/agauniyal/projects/rang/include/rang.hpp":{"contents":"#ifndef RANG_DOT_HPP\n#define RANG_DOT_HPP\n\n#if defined(__unix__) || defined(__unix) || defined(__linux__)\n#define OS_LINUX\n#elif defined(WIN32) || defined(_WIN32) || defined(_WIN64)\n#define OS_WIN\n#elif defined(__APPLE__) || defined(__MACH__)\n#define OS_MAC\n#else\n#error Unknown Platform\n#endif\n\n#if defined(OS_LINUX) || defined(OS_MAC)\n#include <unistd.h>\n#include <cstring>\n#elif defined(OS_WIN)\n#include <windows.h>\n#include <io.h>\n#include <VersionHelpers.h>\n#endif\n\n#include <algorithm>\n#include <cstdlib>\n#include <ios>\n#include <iostream>\n#include <iterator>\n#include <type_traits>\n#include <atomic>\n\nnamespace rang {\n\nenum class style {\n\treset     = 0,\n\tbold      = 1,\n\tdim       = 2,\n\titalic    = 3,\n\tunderline = 4,\n\tblink     = 5,\n\trblink    = 6,\n\treversed  = 7,\n\tconceal   = 8,\n\tcrossed   = 9\n};\n\nenum class fg {\n\tblack   = 30,\n\tred     = 31,\n\tgreen   = 32,\n\tyellow  = 33,\n\tblue    = 34,\n\tmagenta = 35,\n\tcyan    = 36,\n\tgray    = 37,\n\treset   = 39\n};\n\nenum class bg {\n\tblack   = 40,\n\tred     = 41,\n\tgreen   = 42,\n\tyellow  = 43,\n\tblue    = 44,\n\tmagenta = 45,\n\tcyan    = 46,\n\tgray    = 47,\n\treset   = 49\n};\n\nenum class fgB {\n\tblack   = 90,\n\tred     = 91,\n\tgreen   = 92,\n\tyellow  = 93,\n\tblue    = 94,\n\tmagenta = 95,\n\tcyan    = 96,\n\tgray    = 97\n};\n\nenum class bgB {\n\tblack   = 100,\n\tred     = 101,\n\tgreen   = 102,\n\tyellow  = 103,\n\tblue    = 104,\n\tmagenta = 105,\n\tcyan    = 106,\n\tgray    = 107\n};\n\nenum class control { offColor = 0, autoColor = 1, forceColor = 2 };\n\n\nnamespace rang_implementation {\n\n\n\tinline std::streambuf const *&RANG_coutbuf()\n\t{\n\t\tstatic std::streambuf const *pOutbuff = std::cout.rdbuf();\n\t\treturn pOutbuff;\n\t}\n\n\tinline std::streambuf const *&RANG_cerrbuf()\n\t{\n\t\tstatic std::streambuf const *pErrbuff = std::cerr.rdbuf();\n\t\treturn pErrbuff;\n\t}\n\n\tinline std::streambuf const *&RANG_clogbuf()\n\t{\n\t\tstatic std::streambuf const *pLogbuff = std::clog.rdbuf();\n\t\treturn pLogbuff;\n\t}\n\n\n\tinline std::atomic<int> &controlValue()\n\t{\n\t\tstatic std::atomic<int> value(1);\n\t\treturn value;\n\t}\n\n\n\tinline bool supportsColor()\n\t{\n#if defined(OS_LINUX) || defined(OS_MAC)\n\t\tstatic constexpr const char *Terms[] = {\n\t\t\t\"ansi\", \"color\", \"console\", \"cygwin\", \"gnome\", \"konsole\", \"kterm\",\n\t\t\t\"linux\", \"msys\", \"putty\", \"rxvt\", \"screen\", \"vt100\", \"xterm\"\n\t\t};\n\n\t\tstatic const char *env_p = std::getenv(\"TERM\");\n\n\t\tstatic const bool result = (env_p == nullptr)\n\t\t  ? false\n\t\t  : std::any_of(\n\t\t      std::begin(Terms), std::end(Terms), [](const char *term) {\n\t\t\t      return std::strstr(env_p, term) != nullptr;\n\t\t\t  });\n\n#elif defined(OS_WIN)\n\t\tstatic constexpr bool result = true;\n#endif\n\t\treturn result;\n\t}\n\n\n\tinline bool isTerminal(const std::streambuf *osbuf)\n\t{\n\t\tif (osbuf == RANG_coutbuf()) {\n#if defined(OS_LINUX) || defined(OS_MAC)\n\t\t\treturn isatty(fileno(stdout)) ? true : false;\n#elif defined(OS_WIN)\n\t\t\treturn _isatty(_fileno(stdout)) ? true : false;\n#endif\n\t\t}\n\n\t\tif (osbuf == RANG_cerrbuf() || osbuf == RANG_clogbuf()) {\n#if defined(OS_LINUX) || defined(OS_MAC)\n\t\t\treturn isatty(fileno(stderr)) ? true : false;\n#elif defined(OS_WIN)\n\t\t\treturn _isatty(_fileno(stderr)) ? true : false;\n#endif\n\t\t}\n\t\treturn false;\n\t}\n\n\n\ttemplate <typename T>\n\tusing enableStd =\n\t  typename std::enable_if<std::is_same<T, rang::style>::value\n\t      || std::is_same<T, rang::fg>::value\n\t      || std::is_same<T, rang::bg>::value\n\t      || std::is_same<T, rang::fgB>::value\n\t      || std::is_same<T, rang::bgB>::value,\n\t    std::ostream &>::type;\n\n\n#ifdef OS_WIN\n\tHANDLE getVersionDependentHandle()\n\t{\n\t\tif (IsWindowsVersionOrGreater(10, 0, 0)) return nullptr;\n\t\treturn GetStdHandle(STD_OUTPUT_HANDLE);\n\t}\n\n\tinline HANDLE getConsoleHandle()\n\t{\n\t\tstatic HANDLE h = getVersionDependentHandle();\n\t\treturn h;\n\t}\n\n\tinline WORD reverseRGB(WORD rgb)\n\t{\n\t\tstatic const WORD rev[8] = { 0, 4, 2, 6, 1, 5, 3, 7 };\n\t\treturn rev[rgb];\n\t}\n\n\tinline void setWinAttribute(rang::bg col, WORD &state)\n\t{\n\t\tstate &= 0xFF0F;\n\t\tstate |= reverseRGB(static_cast<WORD>(col) - 40) << 4;\n\t}\n\n\tinline void setWinAttribute(rang::fg col, WORD &state)\n\t{\n\t\tstate &= 0xFFF0;\n\t\tstate |= reverseRGB(static_cast<WORD>(col) - 30);\n\t}\n\n\tinline void setWinAttribute(rang::bgB col, WORD &state)\n\t{\n\t\tstate &= 0xFF0F;\n\t\tstate |= (0x8 | reverseRGB(static_cast<WORD>(col) - 100)) << 4;\n\t}\n\n\tinline void setWinAttribute(rang::fgB col, WORD &state)\n\t{\n\t\tstate &= 0xFFF0;\n\t\tstate |= (0x8 | reverseRGB(static_cast<WORD>(col) - 90));\n\t}\n\n\tinline void setWinAttribute(rang::style style, WORD &state)\n\t{\n\t\tif (style == rang::style::reset) {\n\t\t\tstate = (FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED);\n\t\t}\n\t}\n\n\tinline WORD &current_state()\n\t{\n\t\tstatic WORD state\n\t\t  = (FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED);\n\t\treturn state;\n\t}\n\n\n\ttemplate <typename T>\n\tinline enableStd<T> setColor(std::ostream &os, T const value)\n\t{\n\t\tHANDLE h = getConsoleHandle();\n\t\tif (h && isTerminal(os.rdbuf())) {\n\t\t\tsetWinAttribute(value, current_state());\n\t\t\tSetConsoleTextAttribute(h, current_state());\n\t\t\treturn os;\n\t\t}\n\t\treturn os << \"\\033[\" << static_cast<int>(value) << \"m\";\n\t}\n#else\n\ttemplate <typename T>\n\tinline enableStd<T> setColor(std::ostream &os, T const value)\n\t{\n\t\treturn os << \"\\033[\" << static_cast<int>(value) << \"m\";\n\t}\n#endif\n\n\ttemplate <typename T>\n\tusing enableControl =\n\t  typename std::enable_if<std::is_same<T, rang::control>::value,\n\t    std::ostream &>::type;\n}\n\n\nvoid init()\n{\n\trang_implementation::RANG_coutbuf();\n\trang_implementation::RANG_cerrbuf();\n\trang_implementation::RANG_clogbuf();\n}\n\n\ntemplate <typename T>\ninline rang_implementation::enableStd<T> operator<<(\n  std::ostream &os, T const value)\n{\n\tconst int option = rang_implementation::controlValue();\n\tswitch (option) {\n\t\tcase 0: return os;\n\t\tcase 1:\n\t\t\treturn rang_implementation::supportsColor()\n\t\t\t    && rang_implementation::isTerminal(os.rdbuf())\n\t\t\t  ? rang_implementation::setColor(os, value)\n\t\t\t  : os;\n\t\tcase 2: return rang_implementation::setColor(os, value);\n\t\tdefault: return os;\n\t}\n}\n\n\ntemplate <typename T>\ninline rang_implementation::enableControl<T> operator<<(\n  std::ostream &os, T const value)\n{\n\tif (value == rang::control::offColor) {\n\t\trang_implementation::controlValue() = 0;\n\t} else if (value == rang::control::autoColor) {\n\t\trang_implementation::controlValue() = 1;\n\t} else if (value == rang::control::forceColor) {\n\t\trang_implementation::controlValue() = 2;\n\t}\n\treturn os;\n}\n}\n\n#undef OS_LINUX\n#undef OS_WIN\n#undef OS_MAC\n\n#endif /* ifndef RANG_DOT_HPP */\n","filetypes":["cpp"]}},"line_num":9,"column_num":9,"command_arguments":["FixIt"],"completer_target":"filetype_default"}
events.js:160
      throw er; // Unhandled 'error' event
      ^

Error: connect ECONNREFUSED 127.0.0.1:45741
    at Object.exports._errnoException (util.js:1026:11)
    at exports._exceptionWithHostPort (util.js:1049:20)
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1081:14)
[Info  - 1:01:40 PM] Connection to server got closed. Server will restart.
[onDidChangeConfiguration settings] {"ycmd":{"confirm_extra_conf":true,"debug":true,"enabled_languages":["cpp","c"],"global_extra_config":"/home/agauniyal/.vim/.ycm_extra_conf.py","path":"/home/agauniyal/.vim/plugged/YouCompleteMe/third_party/ycmd","python":"/usr/bin/python2","use_imprecise_get_type":true}}
[getInstance] ycm is restarting
[onDidOpen] file:///home/agauniyal/projects/rang/include/rang.hpp
[getInstance] ycm is initializing, delay 200ms...
[onDidChangeContent "file:///home/agauniyal/projects/rang/include/rang.hpp"]
[getInstance] ycm is initializing, delay 200ms...
[onCodeAction] {"textDocument":{"uri":"file:///home/agauniyal/projects/rang/include/rang.hpp"},"range":{"start":{"line":8,"character":8},"end":{"line":8,"character":14}},"context":{"diagnostics":[]}}
[getInstance] ycm is initializing, delay 200ms...
[onCodeAction] {"textDocument":{"uri":"file:///home/agauniyal/projects/rang/include/rang.hpp"},"range":{"start":{"line":8,"character":8},"end":{"line":8,"character":14}},"context":{"diagnostics":[]}}
[getInstance] ycm is initializing, delay 200ms...
[start] unused port: 37087
[start] random secret: 5b66cd8f3d82a3a823ef6a3a7ebeea83
[start] default options: {"filepath_completion_use_working_dir":0,"auto_trigger":1,"min_num_of_chars_for_completion":2,"min_num_identifier_candidate_chars":0,"semantic_triggers":{},"filetype_specific_completion_to_disable":{"gitcommit":1},"seed_identifiers_with_syntax":0,"collect_identifiers_from_comments_and_strings":0,"collect_identifiers_from_tags_files":0,"max_num_identifier_candidates":10,"extra_conf_globlist":[],"global_ycm_extra_conf":"","confirm_extra_conf":1,"complete_in_comments":0,"complete_in_strings":1,"max_diagnostics_to_display":30,"filetype_whitelist":{"*":1},"filetype_blacklist":{"tagbar":1,"qf":1,"notes":1,"markdown":1,"netrw":1,"unite":1,"text":1,"vimwiki":1,"pandoc":1,"infolog":1,"mail":1},"auto_start_csharp_server":1,"auto_stop_csharp_server":1,"use_ultisnips_completer":1,"csharp_server_port":0,"hmac_secret":"","server_keep_logfiles":0,"gocode_binary_path":"","godef_binary_path":"","rust_src_path":"","racerd_binary_path":"","python_binary_path":""}
[processData: {"filepath_completion_use_working_dir":0,"auto_trigger":1,"min_num_of_chars_for_completion":2,"min_num_identifier_candidate_chars":0,"semantic_triggers":{},"filetype_specific_completion_to_disable":{"gitcommit":1},"seed_identifiers_with_syntax":0,"collect_identifiers_from_comments_and_strings":0,"collect_identifiers_from_tags_files":0,"max_num_identifier_candidates":10,"extra_conf_globlist":[],"global_ycm_extra_conf":"/home/agauniyal/.vim/.ycm_extra_conf.py","confirm_extra_conf":true,"complete_in_comments":0,"complete_in_strings":1,"max_diagnostics_to_display":30,"filetype_whitelist":{"*":1},"filetype_blacklist":{"tagbar":1,"qf":1,"notes":1,"markdown":1,"netrw":1,"unite":1,"text":1,"vimwiki":1,"pandoc":1,"infolog":1,"mail":1},"auto_start_csharp_server":1,"auto_stop_csharp_server":1,"use_ultisnips_completer":1,"csharp_server_port":0,"hmac_secret":"W2bNjz2Co6gj72o6fr7qgw==","server_keep_logfiles":0,"gocode_binary_path":"","godef_binary_path":"","rust_src_path":"","racerd_binary_path":"","python_binary_path":"","rustSrcPath":""}]
[start] optionsFile: /tmp/VSCodeYcmOptions-1489217501494
[_start] [ '/home/agauniyal/.vim/plugged/YouCompleteMe/third_party/ycmd/ycmd',
  '--port=37087',
  '--options_file=/tmp/VSCodeYcmOptions-1489217501494',
  '--idle_suicide_seconds=600' ]
[_start] process spawn success 3924
[getInstance] ycm is initializing, delay 200ms...
[getInstance] ycm is initializing, delay 200ms...
[getInstance] ycm is initializing, delay 200ms...
[getInstance] ycm is initializing, delay 200ms...
[getInstance] ycm is initializing, delay 200ms...
[getInstance] ycm is initializing, delay 200ms...
[getInstance] ycm is initializing, delay 200ms...
[getInstance] ycm is initializing, delay 200ms...
[getInstance] ycm is initializing, delay 200ms...
[getInstance] ycm is initializing, delay 200ms...
[getInstance] ycm is initializing, delay 200ms...
[getInstance] ycm is initializing, delay 200ms...
[getInstance] ycm is initializing, delay 200ms...
[getInstance] ycm is initializing, delay 200ms...
[getInstance] ycm is initializing, delay 200ms...
[getInstance] ycm is initializing, delay 200ms...
[getInstance] ycm is initializing, delay 200ms...
[getInstance] ycm is initializing, delay 200ms...
[getInstance] ycm is initializing, delay 200ms...
[getInstance] ycm is initializing, delay 200ms...
[start] ycm started: 3924
[buildRequest] document, /home/agauniyal/projects/rang/include/rang.hpp; position: null; event: BufferVisit
[_request] {"filepath":"/home/agauniyal/projects/rang/include/rang.hpp","working_dir":"/home/agauniyal/projects/rang","file_data":{"/home/agauniyal/projects/rang/include/rang.hpp":{"contents":"#ifndef RANG_DOT_HPP\n#define RANG_DOT_HPP\n\n#if defined(__unix__) || defined(__unix) || defined(__linux__)\n#define OS_LINUX\n#elif defined(WIN32) || defined(_WIN32) || defined(_WIN64)\n#define OS_WIN\n#elif defined(__APPLE__) || defined(__MACH__)\n#define OS_MAC\n#else\n#error Unknown Platform\n#endif\n\n#if defined(OS_LINUX) || defined(OS_MAC)\n#include <unistd.h>\n#include <cstring>\n#elif defined(OS_WIN)\n#include <windows.h>\n#include <io.h>\n#include <VersionHelpers.h>\n#endif\n\n#include <algorithm>\n#include <cstdlib>\n#include <ios>\n#include <iostream>\n#include <iterator>\n#include <type_traits>\n#include <atomic>\n\nnamespace rang {\n\nenum class style {\n\treset     = 0,\n\tbold      = 1,\n\tdim       = 2,\n\titalic    = 3,\n\tunderline = 4,\n\tblink     = 5,\n\trblink    = 6,\n\treversed  = 7,\n\tconceal   = 8,\n\tcrossed   = 9\n};\n\nenum class fg {\n\tblack   = 30,\n\tred     = 31,\n\tgreen   = 32,\n\tyellow  = 33,\n\tblue    = 34,\n\tmagenta = 35,\n\tcyan    = 36,\n\tgray    = 37,\n\treset   = 39\n};\n\nenum class bg {\n\tblack   = 40,\n\tred     = 41,\n\tgreen   = 42,\n\tyellow  = 43,\n\tblue    = 44,\n\tmagenta = 45,\n\tcyan    = 46,\n\tgray    = 47,\n\treset   = 49\n};\n\nenum class fgB {\n\tblack   = 90,\n\tred     = 91,\n\tgreen   = 92,\n\tyellow  = 93,\n\tblue    = 94,\n\tmagenta = 95,\n\tcyan    = 96,\n\tgray    = 97\n};\n\nenum class bgB {\n\tblack   = 100,\n\tred     = 101,\n\tgreen   = 102,\n\tyellow  = 103,\n\tblue    = 104,\n\tmagenta = 105,\n\tcyan    = 106,\n\tgray    = 107\n};\n\nenum class control { offColor = 0, autoColor = 1, forceColor = 2 };\n\n\nnamespace rang_implementation {\n\n\n\tinline std::streambuf const *&RANG_coutbuf()\n\t{\n\t\tstatic std::streambuf const *pOutbuff = std::cout.rdbuf();\n\t\treturn pOutbuff;\n\t}\n\n\tinline std::streambuf const *&RANG_cerrbuf()\n\t{\n\t\tstatic std::streambuf const *pErrbuff = std::cerr.rdbuf();\n\t\treturn pErrbuff;\n\t}\n\n\tinline std::streambuf const *&RANG_clogbuf()\n\t{\n\t\tstatic std::streambuf const *pLogbuff = std::clog.rdbuf();\n\t\treturn pLogbuff;\n\t}\n\n\n\tinline std::atomic<int> &controlValue()\n\t{\n\t\tstatic std::atomic<int> value(1);\n\t\treturn value;\n\t}\n\n\n\tinline bool supportsColor()\n\t{\n#if defined(OS_LINUX) || defined(OS_MAC)\n\t\tstatic constexpr const char *Terms[] = {\n\t\t\t\"ansi\", \"color\", \"console\", \"cygwin\", \"gnome\", \"konsole\", \"kterm\",\n\t\t\t\"linux\", \"msys\", \"putty\", \"rxvt\", \"screen\", \"vt100\", \"xterm\"\n\t\t};\n\n\t\tstatic const char *env_p = std::getenv(\"TERM\");\n\n\t\tstatic const bool result = (env_p == nullptr)\n\t\t  ? false\n\t\t  : std::any_of(\n\t\t      std::begin(Terms), std::end(Terms), [](const char *term) {\n\t\t\t      return std::strstr(env_p, term) != nullptr;\n\t\t\t  });\n\n#elif defined(OS_WIN)\n\t\tstatic constexpr bool result = true;\n#endif\n\t\treturn result;\n\t}\n\n\n\tinline bool isTerminal(const std::streambuf *osbuf)\n\t{\n\t\tif (osbuf == RANG_coutbuf()) {\n#if defined(OS_LINUX) || defined(OS_MAC)\n\t\t\treturn isatty(fileno(stdout)) ? true : false;\n#elif defined(OS_WIN)\n\t\t\treturn _isatty(_fileno(stdout)) ? true : false;\n#endif\n\t\t}\n\n\t\tif (osbuf == RANG_cerrbuf() || osbuf == RANG_clogbuf()) {\n#if defined(OS_LINUX) || defined(OS_MAC)\n\t\t\treturn isatty(fileno(stderr)) ? true : false;\n#elif defined(OS_WIN)\n\t\t\treturn _isatty(_fileno(stderr)) ? true : false;\n#endif\n\t\t}\n\t\treturn false;\n\t}\n\n\n\ttemplate <typename T>\n\tusing enableStd =\n\t  typename std::enable_if<std::is_same<T, rang::style>::value\n\t      || std::is_same<T, rang::fg>::value\n\t      || std::is_same<T, rang::bg>::value\n\t      || std::is_same<T, rang::fgB>::value\n\t      || std::is_same<T, rang::bgB>::value,\n\t    std::ostream &>::type;\n\n\n#ifdef OS_WIN\n\tHANDLE getVersionDependentHandle()\n\t{\n\t\tif (IsWindowsVersionOrGreater(10, 0, 0)) return nullptr;\n\t\treturn GetStdHandle(STD_OUTPUT_HANDLE);\n\t}\n\n\tinline HANDLE getConsoleHandle()\n\t{\n\t\tstatic HANDLE h = getVersionDependentHandle();\n\t\treturn h;\n\t}\n\n\tinline WORD reverseRGB(WORD rgb)\n\t{\n\t\tstatic const WORD rev[8] = { 0, 4, 2, 6, 1, 5, 3, 7 };\n\t\treturn rev[rgb];\n\t}\n\n\tinline void setWinAttribute(rang::bg col, WORD &state)\n\t{\n\t\tstate &= 0xFF0F;\n\t\tstate |= reverseRGB(static_cast<WORD>(col) - 40) << 4;\n\t}\n\n\tinline void setWinAttribute(rang::fg col, WORD &state)\n\t{\n\t\tstate &= 0xFFF0;\n\t\tstate |= reverseRGB(static_cast<WORD>(col) - 30);\n\t}\n\n\tinline void setWinAttribute(rang::bgB col, WORD &state)\n\t{\n\t\tstate &= 0xFF0F;\n\t\tstate |= (0x8 | reverseRGB(static_cast<WORD>(col) - 100)) << 4;\n\t}\n\n\tinline void setWinAttribute(rang::fgB col, WORD &state)\n\t{\n\t\tstate &= 0xFFF0;\n\t\tstate |= (0x8 | reverseRGB(static_cast<WORD>(col) - 90));\n\t}\n\n\tinline void setWinAttribute(rang::style style, WORD &state)\n\t{\n\t\tif (style == rang::style::reset) {\n\t\t\tstate = (FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED);\n\t\t}\n\t}\n\n\tinline WORD &current_state()\n\t{\n\t\tstatic WORD state\n\t\t  = (FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED);\n\t\treturn state;\n\t}\n\n\n\ttemplate <typename T>\n\tinline enableStd<T> setColor(std::ostream &os, T const value)\n\t{\n\t\tHANDLE h = getConsoleHandle();\n\t\tif (h && isTerminal(os.rdbuf())) {\n\t\t\tsetWinAttribute(value, current_state());\n\t\t\tSetConsoleTextAttribute(h, current_state());\n\t\t\treturn os;\n\t\t}\n\t\treturn os << \"\\033[\" << static_cast<int>(value) << \"m\";\n\t}\n#else\n\ttemplate <typename T>\n\tinline enableStd<T> setColor(std::ostream &os, T const value)\n\t{\n\t\treturn os << \"\\033[\" << static_cast<int>(value) << \"m\";\n\t}\n#endif\n\n\ttemplate <typename T>\n\tusing enableControl =\n\t  typename std::enable_if<std::is_same<T, rang::control>::value,\n\t    std::ostream &>::type;\n}\n\n\nvoid init()\n{\n\trang_implementation::RANG_coutbuf();\n\trang_implementation::RANG_cerrbuf();\n\trang_implementation::RANG_clogbuf();\n}\n\n\ntemplate <typename T>\ninline rang_implementation::enableStd<T> operator<<(\n  std::ostream &os, T const value)\n{\n\tconst int option = rang_implementation::controlValue();\n\tswitch (option) {\n\t\tcase 0: return os;\n\t\tcase 1:\n\t\t\treturn rang_implementation::supportsColor()\n\t\t\t    && rang_implementation::isTerminal(os.rdbuf())\n\t\t\t  ? rang_implementation::setColor(os, value)\n\t\t\t  : os;\n\t\tcase 2: return rang_implementation::setColor(os, value);\n\t\tdefault: return os;\n\t}\n}\n\n\ntemplate <typename T>\ninline rang_implementation::enableControl<T> operator<<(\n  std::ostream &os, T const value)\n{\n\tif (value == rang::control::offColor) {\n\t\trang_implementation::controlValue() = 0;\n\t} else if (value == rang::control::autoColor) {\n\t\trang_implementation::controlValue() = 1;\n\t} else if (value == rang::control::forceColor) {\n\t\trang_implementation::controlValue() = 2;\n\t}\n\treturn os;\n}\n}\n\n#undef OS_LINUX\n#undef OS_WIN\n#undef OS_MAC\n\n#endif /* ifndef RANG_DOT_HPP */\n","filetypes":["cpp"]}},"line_num":1,"column_num":1,"event_name":"BufferVisit"}
[buildRequest] document, /home/agauniyal/projects/rang/include/rang.hpp; position: [object Object]; event: null
[_request] {"filepath":"/home/agauniyal/projects/rang/include/rang.hpp","working_dir":"/home/agauniyal/projects/rang","file_data":{"/home/agauniyal/projects/rang/include/rang.hpp":{"contents":"#ifndef RANG_DOT_HPP\n#define RANG_DOT_HPP\n\n#if defined(__unix__) || defined(__unix) || defined(__linux__)\n#define OS_LINUX\n#elif defined(WIN32) || defined(_WIN32) || defined(_WIN64)\n#define OS_WIN\n#elif defined(__APPLE__) || defined(__MACH__)\n#define OS_MAC\n#else\n#error Unknown Platform\n#endif\n\n#if defined(OS_LINUX) || defined(OS_MAC)\n#include <unistd.h>\n#include <cstring>\n#elif defined(OS_WIN)\n#include <windows.h>\n#include <io.h>\n#include <VersionHelpers.h>\n#endif\n\n#include <algorithm>\n#include <cstdlib>\n#include <ios>\n#include <iostream>\n#include <iterator>\n#include <type_traits>\n#include <atomic>\n\nnamespace rang {\n\nenum class style {\n\treset     = 0,\n\tbold      = 1,\n\tdim       = 2,\n\titalic    = 3,\n\tunderline = 4,\n\tblink     = 5,\n\trblink    = 6,\n\treversed  = 7,\n\tconceal   = 8,\n\tcrossed   = 9\n};\n\nenum class fg {\n\tblack   = 30,\n\tred     = 31,\n\tgreen   = 32,\n\tyellow  = 33,\n\tblue    = 34,\n\tmagenta = 35,\n\tcyan    = 36,\n\tgray    = 37,\n\treset   = 39\n};\n\nenum class bg {\n\tblack   = 40,\n\tred     = 41,\n\tgreen   = 42,\n\tyellow  = 43,\n\tblue    = 44,\n\tmagenta = 45,\n\tcyan    = 46,\n\tgray    = 47,\n\treset   = 49\n};\n\nenum class fgB {\n\tblack   = 90,\n\tred     = 91,\n\tgreen   = 92,\n\tyellow  = 93,\n\tblue    = 94,\n\tmagenta = 95,\n\tcyan    = 96,\n\tgray    = 97\n};\n\nenum class bgB {\n\tblack   = 100,\n\tred     = 101,\n\tgreen   = 102,\n\tyellow  = 103,\n\tblue    = 104,\n\tmagenta = 105,\n\tcyan    = 106,\n\tgray    = 107\n};\n\nenum class control { offColor = 0, autoColor = 1, forceColor = 2 };\n\n\nnamespace rang_implementation {\n\n\n\tinline std::streambuf const *&RANG_coutbuf()\n\t{\n\t\tstatic std::streambuf const *pOutbuff = std::cout.rdbuf();\n\t\treturn pOutbuff;\n\t}\n\n\tinline std::streambuf const *&RANG_cerrbuf()\n\t{\n\t\tstatic std::streambuf const *pErrbuff = std::cerr.rdbuf();\n\t\treturn pErrbuff;\n\t}\n\n\tinline std::streambuf const *&RANG_clogbuf()\n\t{\n\t\tstatic std::streambuf const *pLogbuff = std::clog.rdbuf();\n\t\treturn pLogbuff;\n\t}\n\n\n\tinline std::atomic<int> &controlValue()\n\t{\n\t\tstatic std::atomic<int> value(1);\n\t\treturn value;\n\t}\n\n\n\tinline bool supportsColor()\n\t{\n#if defined(OS_LINUX) || defined(OS_MAC)\n\t\tstatic constexpr const char *Terms[] = {\n\t\t\t\"ansi\", \"color\", \"console\", \"cygwin\", \"gnome\", \"konsole\", \"kterm\",\n\t\t\t\"linux\", \"msys\", \"putty\", \"rxvt\", \"screen\", \"vt100\", \"xterm\"\n\t\t};\n\n\t\tstatic const char *env_p = std::getenv(\"TERM\");\n\n\t\tstatic const bool result = (env_p == nullptr)\n\t\t  ? false\n\t\t  : std::any_of(\n\t\t      std::begin(Terms), std::end(Terms), [](const char *term) {\n\t\t\t      return std::strstr(env_p, term) != nullptr;\n\t\t\t  });\n\n#elif defined(OS_WIN)\n\t\tstatic constexpr bool result = true;\n#endif\n\t\treturn result;\n\t}\n\n\n\tinline bool isTerminal(const std::streambuf *osbuf)\n\t{\n\t\tif (osbuf == RANG_coutbuf()) {\n#if defined(OS_LINUX) || defined(OS_MAC)\n\t\t\treturn isatty(fileno(stdout)) ? true : false;\n#elif defined(OS_WIN)\n\t\t\treturn _isatty(_fileno(stdout)) ? true : false;\n#endif\n\t\t}\n\n\t\tif (osbuf == RANG_cerrbuf() || osbuf == RANG_clogbuf()) {\n#if defined(OS_LINUX) || defined(OS_MAC)\n\t\t\treturn isatty(fileno(stderr)) ? true : false;\n#elif defined(OS_WIN)\n\t\t\treturn _isatty(_fileno(stderr)) ? true : false;\n#endif\n\t\t}\n\t\treturn false;\n\t}\n\n\n\ttemplate <typename T>\n\tusing enableStd =\n\t  typename std::enable_if<std::is_same<T, rang::style>::value\n\t      || std::is_same<T, rang::fg>::value\n\t      || std::is_same<T, rang::bg>::value\n\t      || std::is_same<T, rang::fgB>::value\n\t      || std::is_same<T, rang::bgB>::value,\n\t    std::ostream &>::type;\n\n\n#ifdef OS_WIN\n\tHANDLE getVersionDependentHandle()\n\t{\n\t\tif (IsWindowsVersionOrGreater(10, 0, 0)) return nullptr;\n\t\treturn GetStdHandle(STD_OUTPUT_HANDLE);\n\t}\n\n\tinline HANDLE getConsoleHandle()\n\t{\n\t\tstatic HANDLE h = getVersionDependentHandle();\n\t\treturn h;\n\t}\n\n\tinline WORD reverseRGB(WORD rgb)\n\t{\n\t\tstatic const WORD rev[8] = { 0, 4, 2, 6, 1, 5, 3, 7 };\n\t\treturn rev[rgb];\n\t}\n\n\tinline void setWinAttribute(rang::bg col, WORD &state)\n\t{\n\t\tstate &= 0xFF0F;\n\t\tstate |= reverseRGB(static_cast<WORD>(col) - 40) << 4;\n\t}\n\n\tinline void setWinAttribute(rang::fg col, WORD &state)\n\t{\n\t\tstate &= 0xFFF0;\n\t\tstate |= reverseRGB(static_cast<WORD>(col) - 30);\n\t}\n\n\tinline void setWinAttribute(rang::bgB col, WORD &state)\n\t{\n\t\tstate &= 0xFF0F;\n\t\tstate |= (0x8 | reverseRGB(static_cast<WORD>(col) - 100)) << 4;\n\t}\n\n\tinline void setWinAttribute(rang::fgB col, WORD &state)\n\t{\n\t\tstate &= 0xFFF0;\n\t\tstate |= (0x8 | reverseRGB(static_cast<WORD>(col) - 90));\n\t}\n\n\tinline void setWinAttribute(rang::style style, WORD &state)\n\t{\n\t\tif (style == rang::style::reset) {\n\t\t\tstate = (FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED);\n\t\t}\n\t}\n\n\tinline WORD &current_state()\n\t{\n\t\tstatic WORD state\n\t\t  = (FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED);\n\t\treturn state;\n\t}\n\n\n\ttemplate <typename T>\n\tinline enableStd<T> setColor(std::ostream &os, T const value)\n\t{\n\t\tHANDLE h = getConsoleHandle();\n\t\tif (h && isTerminal(os.rdbuf())) {\n\t\t\tsetWinAttribute(value, current_state());\n\t\t\tSetConsoleTextAttribute(h, current_state());\n\t\t\treturn os;\n\t\t}\n\t\treturn os << \"\\033[\" << static_cast<int>(value) << \"m\";\n\t}\n#else\n\ttemplate <typename T>\n\tinline enableStd<T> setColor(std::ostream &os, T const value)\n\t{\n\t\treturn os << \"\\033[\" << static_cast<int>(value) << \"m\";\n\t}\n#endif\n\n\ttemplate <typename T>\n\tusing enableControl =\n\t  typename std::enable_if<std::is_same<T, rang::control>::value,\n\t    std::ostream &>::type;\n}\n\n\nvoid init()\n{\n\trang_implementation::RANG_coutbuf();\n\trang_implementation::RANG_cerrbuf();\n\trang_implementation::RANG_clogbuf();\n}\n\n\ntemplate <typename T>\ninline rang_implementation::enableStd<T> operator<<(\n  std::ostream &os, T const value)\n{\n\tconst int option = rang_implementation::controlValue();\n\tswitch (option) {\n\t\tcase 0: return os;\n\t\tcase 1:\n\t\t\treturn rang_implementation::supportsColor()\n\t\t\t    && rang_implementation::isTerminal(os.rdbuf())\n\t\t\t  ? rang_implementation::setColor(os, value)\n\t\t\t  : os;\n\t\tcase 2: return rang_implementation::setColor(os, value);\n\t\tdefault: return os;\n\t}\n}\n\n\ntemplate <typename T>\ninline rang_implementation::enableControl<T> operator<<(\n  std::ostream &os, T const value)\n{\n\tif (value == rang::control::offColor) {\n\t\trang_implementation::controlValue() = 0;\n\t} else if (value == rang::control::autoColor) {\n\t\trang_implementation::controlValue() = 1;\n\t} else if (value == rang::control::forceColor) {\n\t\trang_implementation::controlValue() = 2;\n\t}\n\treturn os;\n}\n}\n\n#undef OS_LINUX\n#undef OS_WIN\n#undef OS_MAC\n\n#endif /* ifndef RANG_DOT_HPP */\n","filetypes":["cpp"]}},"line_num":9,"column_num":9,"command_arguments":["FixIt"],"completer_target":"filetype_default"}
[buildRequest] document, /home/agauniyal/projects/rang/include/rang.hpp; position: [object Object]; event: null
[_request] {"filepath":"/home/agauniyal/projects/rang/include/rang.hpp","working_dir":"/home/agauniyal/projects/rang","file_data":{"/home/agauniyal/projects/rang/include/rang.hpp":{"contents":"#ifndef RANG_DOT_HPP\n#define RANG_DOT_HPP\n\n#if defined(__unix__) || defined(__unix) || defined(__linux__)\n#define OS_LINUX\n#elif defined(WIN32) || defined(_WIN32) || defined(_WIN64)\n#define OS_WIN\n#elif defined(__APPLE__) || defined(__MACH__)\n#define OS_MAC\n#else\n#error Unknown Platform\n#endif\n\n#if defined(OS_LINUX) || defined(OS_MAC)\n#include <unistd.h>\n#include <cstring>\n#elif defined(OS_WIN)\n#include <windows.h>\n#include <io.h>\n#include <VersionHelpers.h>\n#endif\n\n#include <algorithm>\n#include <cstdlib>\n#include <ios>\n#include <iostream>\n#include <iterator>\n#include <type_traits>\n#include <atomic>\n\nnamespace rang {\n\nenum class style {\n\treset     = 0,\n\tbold      = 1,\n\tdim       = 2,\n\titalic    = 3,\n\tunderline = 4,\n\tblink     = 5,\n\trblink    = 6,\n\treversed  = 7,\n\tconceal   = 8,\n\tcrossed   = 9\n};\n\nenum class fg {\n\tblack   = 30,\n\tred     = 31,\n\tgreen   = 32,\n\tyellow  = 33,\n\tblue    = 34,\n\tmagenta = 35,\n\tcyan    = 36,\n\tgray    = 37,\n\treset   = 39\n};\n\nenum class bg {\n\tblack   = 40,\n\tred     = 41,\n\tgreen   = 42,\n\tyellow  = 43,\n\tblue    = 44,\n\tmagenta = 45,\n\tcyan    = 46,\n\tgray    = 47,\n\treset   = 49\n};\n\nenum class fgB {\n\tblack   = 90,\n\tred     = 91,\n\tgreen   = 92,\n\tyellow  = 93,\n\tblue    = 94,\n\tmagenta = 95,\n\tcyan    = 96,\n\tgray    = 97\n};\n\nenum class bgB {\n\tblack   = 100,\n\tred     = 101,\n\tgreen   = 102,\n\tyellow  = 103,\n\tblue    = 104,\n\tmagenta = 105,\n\tcyan    = 106,\n\tgray    = 107\n};\n\nenum class control { offColor = 0, autoColor = 1, forceColor = 2 };\n\n\nnamespace rang_implementation {\n\n\n\tinline std::streambuf const *&RANG_coutbuf()\n\t{\n\t\tstatic std::streambuf const *pOutbuff = std::cout.rdbuf();\n\t\treturn pOutbuff;\n\t}\n\n\tinline std::streambuf const *&RANG_cerrbuf()\n\t{\n\t\tstatic std::streambuf const *pErrbuff = std::cerr.rdbuf();\n\t\treturn pErrbuff;\n\t}\n\n\tinline std::streambuf const *&RANG_clogbuf()\n\t{\n\t\tstatic std::streambuf const *pLogbuff = std::clog.rdbuf();\n\t\treturn pLogbuff;\n\t}\n\n\n\tinline std::atomic<int> &controlValue()\n\t{\n\t\tstatic std::atomic<int> value(1);\n\t\treturn value;\n\t}\n\n\n\tinline bool supportsColor()\n\t{\n#if defined(OS_LINUX) || defined(OS_MAC)\n\t\tstatic constexpr const char *Terms[] = {\n\t\t\t\"ansi\", \"color\", \"console\", \"cygwin\", \"gnome\", \"konsole\", \"kterm\",\n\t\t\t\"linux\", \"msys\", \"putty\", \"rxvt\", \"screen\", \"vt100\", \"xterm\"\n\t\t};\n\n\t\tstatic const char *env_p = std::getenv(\"TERM\");\n\n\t\tstatic const bool result = (env_p == nullptr)\n\t\t  ? false\n\t\t  : std::any_of(\n\t\t      std::begin(Terms), std::end(Terms), [](const char *term) {\n\t\t\t      return std::strstr(env_p, term) != nullptr;\n\t\t\t  });\n\n#elif defined(OS_WIN)\n\t\tstatic constexpr bool result = true;\n#endif\n\t\treturn result;\n\t}\n\n\n\tinline bool isTerminal(const std::streambuf *osbuf)\n\t{\n\t\tif (osbuf == RANG_coutbuf()) {\n#if defined(OS_LINUX) || defined(OS_MAC)\n\t\t\treturn isatty(fileno(stdout)) ? true : false;\n#elif defined(OS_WIN)\n\t\t\treturn _isatty(_fileno(stdout)) ? true : false;\n#endif\n\t\t}\n\n\t\tif (osbuf == RANG_cerrbuf() || osbuf == RANG_clogbuf()) {\n#if defined(OS_LINUX) || defined(OS_MAC)\n\t\t\treturn isatty(fileno(stderr)) ? true : false;\n#elif defined(OS_WIN)\n\t\t\treturn _isatty(_fileno(stderr)) ? true : false;\n#endif\n\t\t}\n\t\treturn false;\n\t}\n\n\n\ttemplate <typename T>\n\tusing enableStd =\n\t  typename std::enable_if<std::is_same<T, rang::style>::value\n\t      || std::is_same<T, rang::fg>::value\n\t      || std::is_same<T, rang::bg>::value\n\t      || std::is_same<T, rang::fgB>::value\n\t      || std::is_same<T, rang::bgB>::value,\n\t    std::ostream &>::type;\n\n\n#ifdef OS_WIN\n\tHANDLE getVersionDependentHandle()\n\t{\n\t\tif (IsWindowsVersionOrGreater(10, 0, 0)) return nullptr;\n\t\treturn GetStdHandle(STD_OUTPUT_HANDLE);\n\t}\n\n\tinline HANDLE getConsoleHandle()\n\t{\n\t\tstatic HANDLE h = getVersionDependentHandle();\n\t\treturn h;\n\t}\n\n\tinline WORD reverseRGB(WORD rgb)\n\t{\n\t\tstatic const WORD rev[8] = { 0, 4, 2, 6, 1, 5, 3, 7 };\n\t\treturn rev[rgb];\n\t}\n\n\tinline void setWinAttribute(rang::bg col, WORD &state)\n\t{\n\t\tstate &= 0xFF0F;\n\t\tstate |= reverseRGB(static_cast<WORD>(col) - 40) << 4;\n\t}\n\n\tinline void setWinAttribute(rang::fg col, WORD &state)\n\t{\n\t\tstate &= 0xFFF0;\n\t\tstate |= reverseRGB(static_cast<WORD>(col) - 30);\n\t}\n\n\tinline void setWinAttribute(rang::bgB col, WORD &state)\n\t{\n\t\tstate &= 0xFF0F;\n\t\tstate |= (0x8 | reverseRGB(static_cast<WORD>(col) - 100)) << 4;\n\t}\n\n\tinline void setWinAttribute(rang::fgB col, WORD &state)\n\t{\n\t\tstate &= 0xFFF0;\n\t\tstate |= (0x8 | reverseRGB(static_cast<WORD>(col) - 90));\n\t}\n\n\tinline void setWinAttribute(rang::style style, WORD &state)\n\t{\n\t\tif (style == rang::style::reset) {\n\t\t\tstate = (FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED);\n\t\t}\n\t}\n\n\tinline WORD &current_state()\n\t{\n\t\tstatic WORD state\n\t\t  = (FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED);\n\t\treturn state;\n\t}\n\n\n\ttemplate <typename T>\n\tinline enableStd<T> setColor(std::ostream &os, T const value)\n\t{\n\t\tHANDLE h = getConsoleHandle();\n\t\tif (h && isTerminal(os.rdbuf())) {\n\t\t\tsetWinAttribute(value, current_state());\n\t\t\tSetConsoleTextAttribute(h, current_state());\n\t\t\treturn os;\n\t\t}\n\t\treturn os << \"\\033[\" << static_cast<int>(value) << \"m\";\n\t}\n#else\n\ttemplate <typename T>\n\tinline enableStd<T> setColor(std::ostream &os, T const value)\n\t{\n\t\treturn os << \"\\033[\" << static_cast<int>(value) << \"m\";\n\t}\n#endif\n\n\ttemplate <typename T>\n\tusing enableControl =\n\t  typename std::enable_if<std::is_same<T, rang::control>::value,\n\t    std::ostream &>::type;\n}\n\n\nvoid init()\n{\n\trang_implementation::RANG_coutbuf();\n\trang_implementation::RANG_cerrbuf();\n\trang_implementation::RANG_clogbuf();\n}\n\n\ntemplate <typename T>\ninline rang_implementation::enableStd<T> operator<<(\n  std::ostream &os, T const value)\n{\n\tconst int option = rang_implementation::controlValue();\n\tswitch (option) {\n\t\tcase 0: return os;\n\t\tcase 1:\n\t\t\treturn rang_implementation::supportsColor()\n\t\t\t    && rang_implementation::isTerminal(os.rdbuf())\n\t\t\t  ? rang_implementation::setColor(os, value)\n\t\t\t  : os;\n\t\tcase 2: return rang_implementation::setColor(os, value);\n\t\tdefault: return os;\n\t}\n}\n\n\ntemplate <typename T>\ninline rang_implementation::enableControl<T> operator<<(\n  std::ostream &os, T const value)\n{\n\tif (value == rang::control::offColor) {\n\t\trang_implementation::controlValue() = 0;\n\t} else if (value == rang::control::autoColor) {\n\t\trang_implementation::controlValue() = 1;\n\t} else if (value == rang::control::forceColor) {\n\t\trang_implementation::controlValue() = 2;\n\t}\n\treturn os;\n}\n}\n\n#undef OS_LINUX\n#undef OS_WIN\n#undef OS_MAC\n\n#endif /* ifndef RANG_DOT_HPP */\n","filetypes":["cpp"]}},"line_num":9,"column_num":9,"command_arguments":["FixIt"],"completer_target":"filetype_default"}
events.js:160
      throw er; // Unhandled 'error' event
      ^

Error: connect ECONNREFUSED 127.0.0.1:37087
    at Object.exports._errnoException (util.js:1026:11)
    at exports._exceptionWithHostPort (util.js:1049:20)
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1081:14)
[Info  - 1:01:42 PM] Connection to server got closed. Server will restart.
[onDidChangeConfiguration settings] {"ycmd":{"confirm_extra_conf":true,"debug":true,"enabled_languages":["cpp","c"],"global_extra_config":"/home/agauniyal/.vim/.ycm_extra_conf.py","path":"/home/agauniyal/.vim/plugged/YouCompleteMe/third_party/ycmd","python":"/usr/bin/python2","use_imprecise_get_type":true}}
[getInstance] ycm is restarting
[onDidOpen] file:///home/agauniyal/projects/rang/include/rang.hpp
[getInstance] ycm is initializing, delay 200ms...
[onDidChangeContent "file:///home/agauniyal/projects/rang/include/rang.hpp"]
[getInstance] ycm is initializing, delay 200ms...
[onCodeAction] {"textDocument":{"uri":"file:///home/agauniyal/projects/rang/include/rang.hpp"},"range":{"start":{"line":8,"character":8},"end":{"line":8,"character":14}},"context":{"diagnostics":[]}}
[getInstance] ycm is initializing, delay 200ms...
[onCodeAction] {"textDocument":{"uri":"file:///home/agauniyal/projects/rang/include/rang.hpp"},"range":{"start":{"line":8,"character":8},"end":{"line":8,"character":14}},"context":{"diagnostics":[]}}
[getInstance] ycm is initializing, delay 200ms...
[onCodeAction] {"textDocument":{"uri":"file:///home/agauniyal/projects/rang/include/rang.hpp"},"range":{"start":{"line":8,"character":8},"end":{"line":8,"character":14}},"context":{"diagnostics":[]}}
[getInstance] ycm is initializing, delay 200ms...
[start] unused port: 43415
[start] random secret: 295450412be8f6c8b741011a8544b5c7
[start] default options: {"filepath_completion_use_working_dir":0,"auto_trigger":1,"min_num_of_chars_for_completion":2,"min_num_identifier_candidate_chars":0,"semantic_triggers":{},"filetype_specific_completion_to_disable":{"gitcommit":1},"seed_identifiers_with_syntax":0,"collect_identifiers_from_comments_and_strings":0,"collect_identifiers_from_tags_files":0,"max_num_identifier_candidates":10,"extra_conf_globlist":[],"global_ycm_extra_conf":"","confirm_extra_conf":1,"complete_in_comments":0,"complete_in_strings":1,"max_diagnostics_to_display":30,"filetype_whitelist":{"*":1},"filetype_blacklist":{"tagbar":1,"qf":1,"notes":1,"markdown":1,"netrw":1,"unite":1,"text":1,"vimwiki":1,"pandoc":1,"infolog":1,"mail":1},"auto_start_csharp_server":1,"auto_stop_csharp_server":1,"use_ultisnips_completer":1,"csharp_server_port":0,"hmac_secret":"","server_keep_logfiles":0,"gocode_binary_path":"","godef_binary_path":"","rust_src_path":"","racerd_binary_path":"","python_binary_path":""}
[processData: {"filepath_completion_use_working_dir":0,"auto_trigger":1,"min_num_of_chars_for_completion":2,"min_num_identifier_candidate_chars":0,"semantic_triggers":{},"filetype_specific_completion_to_disable":{"gitcommit":1},"seed_identifiers_with_syntax":0,"collect_identifiers_from_comments_and_strings":0,"collect_identifiers_from_tags_files":0,"max_num_identifier_candidates":10,"extra_conf_globlist":[],"global_ycm_extra_conf":"/home/agauniyal/.vim/.ycm_extra_conf.py","confirm_extra_conf":true,"complete_in_comments":0,"complete_in_strings":1,"max_diagnostics_to_display":30,"filetype_whitelist":{"*":1},"filetype_blacklist":{"tagbar":1,"qf":1,"notes":1,"markdown":1,"netrw":1,"unite":1,"text":1,"vimwiki":1,"pandoc":1,"infolog":1,"mail":1},"auto_start_csharp_server":1,"auto_stop_csharp_server":1,"use_ultisnips_completer":1,"csharp_server_port":0,"hmac_secret":"KVRQQSvo9si3QQEahUS1xw==","server_keep_logfiles":0,"gocode_binary_path":"","godef_binary_path":"","rust_src_path":"","racerd_binary_path":"","python_binary_path":"","rustSrcPath":""}]
[start] optionsFile: /tmp/VSCodeYcmOptions-1489217503158
[_start] [ '/home/agauniyal/.vim/plugged/YouCompleteMe/third_party/ycmd/ycmd',
  '--port=43415',
  '--options_file=/tmp/VSCodeYcmOptions-1489217503158',
  '--idle_suicide_seconds=600' ]
[_start] process spawn success 3933
[getInstance] ycm is initializing, delay 200ms...
[getInstance] ycm is initializing, delay 200ms...
[getInstance] ycm is initializing, delay 200ms...
[getInstance] ycm is initializing, delay 200ms...
[getInstance] ycm is initializing, delay 200ms...
[getInstance] ycm is initializing, delay 200ms...
[getInstance] ycm is initializing, delay 200ms...
[getInstance] ycm is initializing, delay 200ms...
[getInstance] ycm is initializing, delay 200ms...
[getInstance] ycm is initializing, delay 200ms...
[getInstance] ycm is initializing, delay 200ms...
[getInstance] ycm is initializing, delay 200ms...
[getInstance] ycm is initializing, delay 200ms...
[getInstance] ycm is initializing, delay 200ms...
[getInstance] ycm is initializing, delay 200ms...
[getInstance] ycm is initializing, delay 200ms...
[getInstance] ycm is initializing, delay 200ms...
[getInstance] ycm is initializing, delay 200ms...
[getInstance] ycm is initializing, delay 200ms...
[getInstance] ycm is initializing, delay 200ms...
[getInstance] ycm is initializing, delay 200ms...
[getInstance] ycm is initializing, delay 200ms...
[getInstance] ycm is initializing, delay 200ms...
[getInstance] ycm is initializing, delay 200ms...
[getInstance] ycm is initializing, delay 200ms...
[start] ycm started: 3933
[buildRequest] document, /home/agauniyal/projects/rang/include/rang.hpp; position: null; event: BufferVisit
[_request] {"filepath":"/home/agauniyal/projects/rang/include/rang.hpp","working_dir":"/home/agauniyal/projects/rang","file_data":{"/home/agauniyal/projects/rang/include/rang.hpp":{"contents":"#ifndef RANG_DOT_HPP\n#define RANG_DOT_HPP\n\n#if defined(__unix__) || defined(__unix) || defined(__linux__)\n#define OS_LINUX\n#elif defined(WIN32) || defined(_WIN32) || defined(_WIN64)\n#define OS_WIN\n#elif defined(__APPLE__) || defined(__MACH__)\n#define OS_MAC\n#else\n#error Unknown Platform\n#endif\n\n#if defined(OS_LINUX) || defined(OS_MAC)\n#include <unistd.h>\n#include <cstring>\n#elif defined(OS_WIN)\n#include <windows.h>\n#include <io.h>\n#include <VersionHelpers.h>\n#endif\n\n#include <algorithm>\n#include <cstdlib>\n#include <ios>\n#include <iostream>\n#include <iterator>\n#include <type_traits>\n#include <atomic>\n\nnamespace rang {\n\nenum class style {\n\treset     = 0,\n\tbold      = 1,\n\tdim       = 2,\n\titalic    = 3,\n\tunderline = 4,\n\tblink     = 5,\n\trblink    = 6,\n\treversed  = 7,\n\tconceal   = 8,\n\tcrossed   = 9\n};\n\nenum class fg {\n\tblack   = 30,\n\tred     = 31,\n\tgreen   = 32,\n\tyellow  = 33,\n\tblue    = 34,\n\tmagenta = 35,\n\tcyan    = 36,\n\tgray    = 37,\n\treset   = 39\n};\n\nenum class bg {\n\tblack   = 40,\n\tred     = 41,\n\tgreen   = 42,\n\tyellow  = 43,\n\tblue    = 44,\n\tmagenta = 45,\n\tcyan    = 46,\n\tgray    = 47,\n\treset   = 49\n};\n\nenum class fgB {\n\tblack   = 90,\n\tred     = 91,\n\tgreen   = 92,\n\tyellow  = 93,\n\tblue    = 94,\n\tmagenta = 95,\n\tcyan    = 96,\n\tgray    = 97\n};\n\nenum class bgB {\n\tblack   = 100,\n\tred     = 101,\n\tgreen   = 102,\n\tyellow  = 103,\n\tblue    = 104,\n\tmagenta = 105,\n\tcyan    = 106,\n\tgray    = 107\n};\n\nenum class control { offColor = 0, autoColor = 1, forceColor = 2 };\n\n\nnamespace rang_implementation {\n\n\n\tinline std::streambuf const *&RANG_coutbuf()\n\t{\n\t\tstatic std::streambuf const *pOutbuff = std::cout.rdbuf();\n\t\treturn pOutbuff;\n\t}\n\n\tinline std::streambuf const *&RANG_cerrbuf()\n\t{\n\t\tstatic std::streambuf const *pErrbuff = std::cerr.rdbuf();\n\t\treturn pErrbuff;\n\t}\n\n\tinline std::streambuf const *&RANG_clogbuf()\n\t{\n\t\tstatic std::streambuf const *pLogbuff = std::clog.rdbuf();\n\t\treturn pLogbuff;\n\t}\n\n\n\tinline std::atomic<int> &controlValue()\n\t{\n\t\tstatic std::atomic<int> value(1);\n\t\treturn value;\n\t}\n\n\n\tinline bool supportsColor()\n\t{\n#if defined(OS_LINUX) || defined(OS_MAC)\n\t\tstatic constexpr const char *Terms[] = {\n\t\t\t\"ansi\", \"color\", \"console\", \"cygwin\", \"gnome\", \"konsole\", \"kterm\",\n\t\t\t\"linux\", \"msys\", \"putty\", \"rxvt\", \"screen\", \"vt100\", \"xterm\"\n\t\t};\n\n\t\tstatic const char *env_p = std::getenv(\"TERM\");\n\n\t\tstatic const bool result = (env_p == nullptr)\n\t\t  ? false\n\t\t  : std::any_of(\n\t\t      std::begin(Terms), std::end(Terms), [](const char *term) {\n\t\t\t      return std::strstr(env_p, term) != nullptr;\n\t\t\t  });\n\n#elif defined(OS_WIN)\n\t\tstatic constexpr bool result = true;\n#endif\n\t\treturn result;\n\t}\n\n\n\tinline bool isTerminal(const std::streambuf *osbuf)\n\t{\n\t\tif (osbuf == RANG_coutbuf()) {\n#if defined(OS_LINUX) || defined(OS_MAC)\n\t\t\treturn isatty(fileno(stdout)) ? true : false;\n#elif defined(OS_WIN)\n\t\t\treturn _isatty(_fileno(stdout)) ? true : false;\n#endif\n\t\t}\n\n\t\tif (osbuf == RANG_cerrbuf() || osbuf == RANG_clogbuf()) {\n#if defined(OS_LINUX) || defined(OS_MAC)\n\t\t\treturn isatty(fileno(stderr)) ? true : false;\n#elif defined(OS_WIN)\n\t\t\treturn _isatty(_fileno(stderr)) ? true : false;\n#endif\n\t\t}\n\t\treturn false;\n\t}\n\n\n\ttemplate <typename T>\n\tusing enableStd =\n\t  typename std::enable_if<std::is_same<T, rang::style>::value\n\t      || std::is_same<T, rang::fg>::value\n\t      || std::is_same<T, rang::bg>::value\n\t      || std::is_same<T, rang::fgB>::value\n\t      || std::is_same<T, rang::bgB>::value,\n\t    std::ostream &>::type;\n\n\n#ifdef OS_WIN\n\tHANDLE getVersionDependentHandle()\n\t{\n\t\tif (IsWindowsVersionOrGreater(10, 0, 0)) return nullptr;\n\t\treturn GetStdHandle(STD_OUTPUT_HANDLE);\n\t}\n\n\tinline HANDLE getConsoleHandle()\n\t{\n\t\tstatic HANDLE h = getVersionDependentHandle();\n\t\treturn h;\n\t}\n\n\tinline WORD reverseRGB(WORD rgb)\n\t{\n\t\tstatic const WORD rev[8] = { 0, 4, 2, 6, 1, 5, 3, 7 };\n\t\treturn rev[rgb];\n\t}\n\n\tinline void setWinAttribute(rang::bg col, WORD &state)\n\t{\n\t\tstate &= 0xFF0F;\n\t\tstate |= reverseRGB(static_cast<WORD>(col) - 40) << 4;\n\t}\n\n\tinline void setWinAttribute(rang::fg col, WORD &state)\n\t{\n\t\tstate &= 0xFFF0;\n\t\tstate |= reverseRGB(static_cast<WORD>(col) - 30);\n\t}\n\n\tinline void setWinAttribute(rang::bgB col, WORD &state)\n\t{\n\t\tstate &= 0xFF0F;\n\t\tstate |= (0x8 | reverseRGB(static_cast<WORD>(col) - 100)) << 4;\n\t}\n\n\tinline void setWinAttribute(rang::fgB col, WORD &state)\n\t{\n\t\tstate &= 0xFFF0;\n\t\tstate |= (0x8 | reverseRGB(static_cast<WORD>(col) - 90));\n\t}\n\n\tinline void setWinAttribute(rang::style style, WORD &state)\n\t{\n\t\tif (style == rang::style::reset) {\n\t\t\tstate = (FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED);\n\t\t}\n\t}\n\n\tinline WORD &current_state()\n\t{\n\t\tstatic WORD state\n\t\t  = (FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED);\n\t\treturn state;\n\t}\n\n\n\ttemplate <typename T>\n\tinline enableStd<T> setColor(std::ostream &os, T const value)\n\t{\n\t\tHANDLE h = getConsoleHandle();\n\t\tif (h && isTerminal(os.rdbuf())) {\n\t\t\tsetWinAttribute(value, current_state());\n\t\t\tSetConsoleTextAttribute(h, current_state());\n\t\t\treturn os;\n\t\t}\n\t\treturn os << \"\\033[\" << static_cast<int>(value) << \"m\";\n\t}\n#else\n\ttemplate <typename T>\n\tinline enableStd<T> setColor(std::ostream &os, T const value)\n\t{\n\t\treturn os << \"\\033[\" << static_cast<int>(value) << \"m\";\n\t}\n#endif\n\n\ttemplate <typename T>\n\tusing enableControl =\n\t  typename std::enable_if<std::is_same<T, rang::control>::value,\n\t    std::ostream &>::type;\n}\n\n\nvoid init()\n{\n\trang_implementation::RANG_coutbuf();\n\trang_implementation::RANG_cerrbuf();\n\trang_implementation::RANG_clogbuf();\n}\n\n\ntemplate <typename T>\ninline rang_implementation::enableStd<T> operator<<(\n  std::ostream &os, T const value)\n{\n\tconst int option = rang_implementation::controlValue();\n\tswitch (option) {\n\t\tcase 0: return os;\n\t\tcase 1:\n\t\t\treturn rang_implementation::supportsColor()\n\t\t\t    && rang_implementation::isTerminal(os.rdbuf())\n\t\t\t  ? rang_implementation::setColor(os, value)\n\t\t\t  : os;\n\t\tcase 2: return rang_implementation::setColor(os, value);\n\t\tdefault: return os;\n\t}\n}\n\n\ntemplate <typename T>\ninline rang_implementation::enableControl<T> operator<<(\n  std::ostream &os, T const value)\n{\n\tif (value == rang::control::offColor) {\n\t\trang_implementation::controlValue() = 0;\n\t} else if (value == rang::control::autoColor) {\n\t\trang_implementation::controlValue() = 1;\n\t} else if (value == rang::control::forceColor) {\n\t\trang_implementation::controlValue() = 2;\n\t}\n\treturn os;\n}\n}\n\n#undef OS_LINUX\n#undef OS_WIN\n#undef OS_MAC\n\n#endif /* ifndef RANG_DOT_HPP */\n","filetypes":["cpp"]}},"line_num":1,"column_num":1,"event_name":"BufferVisit"}
[buildRequest] document, /home/agauniyal/projects/rang/include/rang.hpp; position: [object Object]; event: null
[_request] {"filepath":"/home/agauniyal/projects/rang/include/rang.hpp","working_dir":"/home/agauniyal/projects/rang","file_data":{"/home/agauniyal/projects/rang/include/rang.hpp":{"contents":"#ifndef RANG_DOT_HPP\n#define RANG_DOT_HPP\n\n#if defined(__unix__) || defined(__unix) || defined(__linux__)\n#define OS_LINUX\n#elif defined(WIN32) || defined(_WIN32) || defined(_WIN64)\n#define OS_WIN\n#elif defined(__APPLE__) || defined(__MACH__)\n#define OS_MAC\n#else\n#error Unknown Platform\n#endif\n\n#if defined(OS_LINUX) || defined(OS_MAC)\n#include <unistd.h>\n#include <cstring>\n#elif defined(OS_WIN)\n#include <windows.h>\n#include <io.h>\n#include <VersionHelpers.h>\n#endif\n\n#include <algorithm>\n#include <cstdlib>\n#include <ios>\n#include <iostream>\n#include <iterator>\n#include <type_traits>\n#include <atomic>\n\nnamespace rang {\n\nenum class style {\n\treset     = 0,\n\tbold      = 1,\n\tdim       = 2,\n\titalic    = 3,\n\tunderline = 4,\n\tblink     = 5,\n\trblink    = 6,\n\treversed  = 7,\n\tconceal   = 8,\n\tcrossed   = 9\n};\n\nenum class fg {\n\tblack   = 30,\n\tred     = 31,\n\tgreen   = 32,\n\tyellow  = 33,\n\tblue    = 34,\n\tmagenta = 35,\n\tcyan    = 36,\n\tgray    = 37,\n\treset   = 39\n};\n\nenum class bg {\n\tblack   = 40,\n\tred     = 41,\n\tgreen   = 42,\n\tyellow  = 43,\n\tblue    = 44,\n\tmagenta = 45,\n\tcyan    = 46,\n\tgray    = 47,\n\treset   = 49\n};\n\nenum class fgB {\n\tblack   = 90,\n\tred     = 91,\n\tgreen   = 92,\n\tyellow  = 93,\n\tblue    = 94,\n\tmagenta = 95,\n\tcyan    = 96,\n\tgray    = 97\n};\n\nenum class bgB {\n\tblack   = 100,\n\tred     = 101,\n\tgreen   = 102,\n\tyellow  = 103,\n\tblue    = 104,\n\tmagenta = 105,\n\tcyan    = 106,\n\tgray    = 107\n};\n\nenum class control { offColor = 0, autoColor = 1, forceColor = 2 };\n\n\nnamespace rang_implementation {\n\n\n\tinline std::streambuf const *&RANG_coutbuf()\n\t{\n\t\tstatic std::streambuf const *pOutbuff = std::cout.rdbuf();\n\t\treturn pOutbuff;\n\t}\n\n\tinline std::streambuf const *&RANG_cerrbuf()\n\t{\n\t\tstatic std::streambuf const *pErrbuff = std::cerr.rdbuf();\n\t\treturn pErrbuff;\n\t}\n\n\tinline std::streambuf const *&RANG_clogbuf()\n\t{\n\t\tstatic std::streambuf const *pLogbuff = std::clog.rdbuf();\n\t\treturn pLogbuff;\n\t}\n\n\n\tinline std::atomic<int> &controlValue()\n\t{\n\t\tstatic std::atomic<int> value(1);\n\t\treturn value;\n\t}\n\n\n\tinline bool supportsColor()\n\t{\n#if defined(OS_LINUX) || defined(OS_MAC)\n\t\tstatic constexpr const char *Terms[] = {\n\t\t\t\"ansi\", \"color\", \"console\", \"cygwin\", \"gnome\", \"konsole\", \"kterm\",\n\t\t\t\"linux\", \"msys\", \"putty\", \"rxvt\", \"screen\", \"vt100\", \"xterm\"\n\t\t};\n\n\t\tstatic const char *env_p = std::getenv(\"TERM\");\n\n\t\tstatic const bool result = (env_p == nullptr)\n\t\t  ? false\n\t\t  : std::any_of(\n\t\t      std::begin(Terms), std::end(Terms), [](const char *term) {\n\t\t\t      return std::strstr(env_p, term) != nullptr;\n\t\t\t  });\n\n#elif defined(OS_WIN)\n\t\tstatic constexpr bool result = true;\n#endif\n\t\treturn result;\n\t}\n\n\n\tinline bool isTerminal(const std::streambuf *osbuf)\n\t{\n\t\tif (osbuf == RANG_coutbuf()) {\n#if defined(OS_LINUX) || defined(OS_MAC)\n\t\t\treturn isatty(fileno(stdout)) ? true : false;\n#elif defined(OS_WIN)\n\t\t\treturn _isatty(_fileno(stdout)) ? true : false;\n#endif\n\t\t}\n\n\t\tif (osbuf == RANG_cerrbuf() || osbuf == RANG_clogbuf()) {\n#if defined(OS_LINUX) || defined(OS_MAC)\n\t\t\treturn isatty(fileno(stderr)) ? true : false;\n#elif defined(OS_WIN)\n\t\t\treturn _isatty(_fileno(stderr)) ? true : false;\n#endif\n\t\t}\n\t\treturn false;\n\t}\n\n\n\ttemplate <typename T>\n\tusing enableStd =\n\t  typename std::enable_if<std::is_same<T, rang::style>::value\n\t      || std::is_same<T, rang::fg>::value\n\t      || std::is_same<T, rang::bg>::value\n\t      || std::is_same<T, rang::fgB>::value\n\t      || std::is_same<T, rang::bgB>::value,\n\t    std::ostream &>::type;\n\n\n#ifdef OS_WIN\n\tHANDLE getVersionDependentHandle()\n\t{\n\t\tif (IsWindowsVersionOrGreater(10, 0, 0)) return nullptr;\n\t\treturn GetStdHandle(STD_OUTPUT_HANDLE);\n\t}\n\n\tinline HANDLE getConsoleHandle()\n\t{\n\t\tstatic HANDLE h = getVersionDependentHandle();\n\t\treturn h;\n\t}\n\n\tinline WORD reverseRGB(WORD rgb)\n\t{\n\t\tstatic const WORD rev[8] = { 0, 4, 2, 6, 1, 5, 3, 7 };\n\t\treturn rev[rgb];\n\t}\n\n\tinline void setWinAttribute(rang::bg col, WORD &state)\n\t{\n\t\tstate &= 0xFF0F;\n\t\tstate |= reverseRGB(static_cast<WORD>(col) - 40) << 4;\n\t}\n\n\tinline void setWinAttribute(rang::fg col, WORD &state)\n\t{\n\t\tstate &= 0xFFF0;\n\t\tstate |= reverseRGB(static_cast<WORD>(col) - 30);\n\t}\n\n\tinline void setWinAttribute(rang::bgB col, WORD &state)\n\t{\n\t\tstate &= 0xFF0F;\n\t\tstate |= (0x8 | reverseRGB(static_cast<WORD>(col) - 100)) << 4;\n\t}\n\n\tinline void setWinAttribute(rang::fgB col, WORD &state)\n\t{\n\t\tstate &= 0xFFF0;\n\t\tstate |= (0x8 | reverseRGB(static_cast<WORD>(col) - 90));\n\t}\n\n\tinline void setWinAttribute(rang::style style, WORD &state)\n\t{\n\t\tif (style == rang::style::reset) {\n\t\t\tstate = (FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED);\n\t\t}\n\t}\n\n\tinline WORD &current_state()\n\t{\n\t\tstatic WORD state\n\t\t  = (FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED);\n\t\treturn state;\n\t}\n\n\n\ttemplate <typename T>\n\tinline enableStd<T> setColor(std::ostream &os, T const value)\n\t{\n\t\tHANDLE h = getConsoleHandle();\n\t\tif (h && isTerminal(os.rdbuf())) {\n\t\t\tsetWinAttribute(value, current_state());\n\t\t\tSetConsoleTextAttribute(h, current_state());\n\t\t\treturn os;\n\t\t}\n\t\treturn os << \"\\033[\" << static_cast<int>(value) << \"m\";\n\t}\n#else\n\ttemplate <typename T>\n\tinline enableStd<T> setColor(std::ostream &os, T const value)\n\t{\n\t\treturn os << \"\\033[\" << static_cast<int>(value) << \"m\";\n\t}\n#endif\n\n\ttemplate <typename T>\n\tusing enableControl =\n\t  typename std::enable_if<std::is_same<T, rang::control>::value,\n\t    std::ostream &>::type;\n}\n\n\nvoid init()\n{\n\trang_implementation::RANG_coutbuf();\n\trang_implementation::RANG_cerrbuf();\n\trang_implementation::RANG_clogbuf();\n}\n\n\ntemplate <typename T>\ninline rang_implementation::enableStd<T> operator<<(\n  std::ostream &os, T const value)\n{\n\tconst int option = rang_implementation::controlValue();\n\tswitch (option) {\n\t\tcase 0: return os;\n\t\tcase 1:\n\t\t\treturn rang_implementation::supportsColor()\n\t\t\t    && rang_implementation::isTerminal(os.rdbuf())\n\t\t\t  ? rang_implementation::setColor(os, value)\n\t\t\t  : os;\n\t\tcase 2: return rang_implementation::setColor(os, value);\n\t\tdefault: return os;\n\t}\n}\n\n\ntemplate <typename T>\ninline rang_implementation::enableControl<T> operator<<(\n  std::ostream &os, T const value)\n{\n\tif (value == rang::control::offColor) {\n\t\trang_implementation::controlValue() = 0;\n\t} else if (value == rang::control::autoColor) {\n\t\trang_implementation::controlValue() = 1;\n\t} else if (value == rang::control::forceColor) {\n\t\trang_implementation::controlValue() = 2;\n\t}\n\treturn os;\n}\n}\n\n#undef OS_LINUX\n#undef OS_WIN\n#undef OS_MAC\n\n#endif /* ifndef RANG_DOT_HPP */\n","filetypes":["cpp"]}},"line_num":9,"column_num":9,"command_arguments":["FixIt"],"completer_target":"filetype_default"}
[buildRequest] document, /home/agauniyal/projects/rang/include/rang.hpp; position: [object Object]; event: null
[_request] {"filepath":"/home/agauniyal/projects/rang/include/rang.hpp","working_dir":"/home/agauniyal/projects/rang","file_data":{"/home/agauniyal/projects/rang/include/rang.hpp":{"contents":"#ifndef RANG_DOT_HPP\n#define RANG_DOT_HPP\n\n#if defined(__unix__) || defined(__unix) || defined(__linux__)\n#define OS_LINUX\n#elif defined(WIN32) || defined(_WIN32) || defined(_WIN64)\n#define OS_WIN\n#elif defined(__APPLE__) || defined(__MACH__)\n#define OS_MAC\n#else\n#error Unknown Platform\n#endif\n\n#if defined(OS_LINUX) || defined(OS_MAC)\n#include <unistd.h>\n#include <cstring>\n#elif defined(OS_WIN)\n#include <windows.h>\n#include <io.h>\n#include <VersionHelpers.h>\n#endif\n\n#include <algorithm>\n#include <cstdlib>\n#include <ios>\n#include <iostream>\n#include <iterator>\n#include <type_traits>\n#include <atomic>\n\nnamespace rang {\n\nenum class style {\n\treset     = 0,\n\tbold      = 1,\n\tdim       = 2,\n\titalic    = 3,\n\tunderline = 4,\n\tblink     = 5,\n\trblink    = 6,\n\treversed  = 7,\n\tconceal   = 8,\n\tcrossed   = 9\n};\n\nenum class fg {\n\tblack   = 30,\n\tred     = 31,\n\tgreen   = 32,\n\tyellow  = 33,\n\tblue    = 34,\n\tmagenta = 35,\n\tcyan    = 36,\n\tgray    = 37,\n\treset   = 39\n};\n\nenum class bg {\n\tblack   = 40,\n\tred     = 41,\n\tgreen   = 42,\n\tyellow  = 43,\n\tblue    = 44,\n\tmagenta = 45,\n\tcyan    = 46,\n\tgray    = 47,\n\treset   = 49\n};\n\nenum class fgB {\n\tblack   = 90,\n\tred     = 91,\n\tgreen   = 92,\n\tyellow  = 93,\n\tblue    = 94,\n\tmagenta = 95,\n\tcyan    = 96,\n\tgray    = 97\n};\n\nenum class bgB {\n\tblack   = 100,\n\tred     = 101,\n\tgreen   = 102,\n\tyellow  = 103,\n\tblue    = 104,\n\tmagenta = 105,\n\tcyan    = 106,\n\tgray    = 107\n};\n\nenum class control { offColor = 0, autoColor = 1, forceColor = 2 };\n\n\nnamespace rang_implementation {\n\n\n\tinline std::streambuf const *&RANG_coutbuf()\n\t{\n\t\tstatic std::streambuf const *pOutbuff = std::cout.rdbuf();\n\t\treturn pOutbuff;\n\t}\n\n\tinline std::streambuf const *&RANG_cerrbuf()\n\t{\n\t\tstatic std::streambuf const *pErrbuff = std::cerr.rdbuf();\n\t\treturn pErrbuff;\n\t}\n\n\tinline std::streambuf const *&RANG_clogbuf()\n\t{\n\t\tstatic std::streambuf const *pLogbuff = std::clog.rdbuf();\n\t\treturn pLogbuff;\n\t}\n\n\n\tinline std::atomic<int> &controlValue()\n\t{\n\t\tstatic std::atomic<int> value(1);\n\t\treturn value;\n\t}\n\n\n\tinline bool supportsColor()\n\t{\n#if defined(OS_LINUX) || defined(OS_MAC)\n\t\tstatic constexpr const char *Terms[] = {\n\t\t\t\"ansi\", \"color\", \"console\", \"cygwin\", \"gnome\", \"konsole\", \"kterm\",\n\t\t\t\"linux\", \"msys\", \"putty\", \"rxvt\", \"screen\", \"vt100\", \"xterm\"\n\t\t};\n\n\t\tstatic const char *env_p = std::getenv(\"TERM\");\n\n\t\tstatic const bool result = (env_p == nullptr)\n\t\t  ? false\n\t\t  : std::any_of(\n\t\t      std::begin(Terms), std::end(Terms), [](const char *term) {\n\t\t\t      return std::strstr(env_p, term) != nullptr;\n\t\t\t  });\n\n#elif defined(OS_WIN)\n\t\tstatic constexpr bool result = true;\n#endif\n\t\treturn result;\n\t}\n\n\n\tinline bool isTerminal(const std::streambuf *osbuf)\n\t{\n\t\tif (osbuf == RANG_coutbuf()) {\n#if defined(OS_LINUX) || defined(OS_MAC)\n\t\t\treturn isatty(fileno(stdout)) ? true : false;\n#elif defined(OS_WIN)\n\t\t\treturn _isatty(_fileno(stdout)) ? true : false;\n#endif\n\t\t}\n\n\t\tif (osbuf == RANG_cerrbuf() || osbuf == RANG_clogbuf()) {\n#if defined(OS_LINUX) || defined(OS_MAC)\n\t\t\treturn isatty(fileno(stderr)) ? true : false;\n#elif defined(OS_WIN)\n\t\t\treturn _isatty(_fileno(stderr)) ? true : false;\n#endif\n\t\t}\n\t\treturn false;\n\t}\n\n\n\ttemplate <typename T>\n\tusing enableStd =\n\t  typename std::enable_if<std::is_same<T, rang::style>::value\n\t      || std::is_same<T, rang::fg>::value\n\t      || std::is_same<T, rang::bg>::value\n\t      || std::is_same<T, rang::fgB>::value\n\t      || std::is_same<T, rang::bgB>::value,\n\t    std::ostream &>::type;\n\n\n#ifdef OS_WIN\n\tHANDLE getVersionDependentHandle()\n\t{\n\t\tif (IsWindowsVersionOrGreater(10, 0, 0)) return nullptr;\n\t\treturn GetStdHandle(STD_OUTPUT_HANDLE);\n\t}\n\n\tinline HANDLE getConsoleHandle()\n\t{\n\t\tstatic HANDLE h = getVersionDependentHandle();\n\t\treturn h;\n\t}\n\n\tinline WORD reverseRGB(WORD rgb)\n\t{\n\t\tstatic const WORD rev[8] = { 0, 4, 2, 6, 1, 5, 3, 7 };\n\t\treturn rev[rgb];\n\t}\n\n\tinline void setWinAttribute(rang::bg col, WORD &state)\n\t{\n\t\tstate &= 0xFF0F;\n\t\tstate |= reverseRGB(static_cast<WORD>(col) - 40) << 4;\n\t}\n\n\tinline void setWinAttribute(rang::fg col, WORD &state)\n\t{\n\t\tstate &= 0xFFF0;\n\t\tstate |= reverseRGB(static_cast<WORD>(col) - 30);\n\t}\n\n\tinline void setWinAttribute(rang::bgB col, WORD &state)\n\t{\n\t\tstate &= 0xFF0F;\n\t\tstate |= (0x8 | reverseRGB(static_cast<WORD>(col) - 100)) << 4;\n\t}\n\n\tinline void setWinAttribute(rang::fgB col, WORD &state)\n\t{\n\t\tstate &= 0xFFF0;\n\t\tstate |= (0x8 | reverseRGB(static_cast<WORD>(col) - 90));\n\t}\n\n\tinline void setWinAttribute(rang::style style, WORD &state)\n\t{\n\t\tif (style == rang::style::reset) {\n\t\t\tstate = (FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED);\n\t\t}\n\t}\n\n\tinline WORD &current_state()\n\t{\n\t\tstatic WORD state\n\t\t  = (FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED);\n\t\treturn state;\n\t}\n\n\n\ttemplate <typename T>\n\tinline enableStd<T> setColor(std::ostream &os, T const value)\n\t{\n\t\tHANDLE h = getConsoleHandle();\n\t\tif (h && isTerminal(os.rdbuf())) {\n\t\t\tsetWinAttribute(value, current_state());\n\t\t\tSetConsoleTextAttribute(h, current_state());\n\t\t\treturn os;\n\t\t}\n\t\treturn os << \"\\033[\" << static_cast<int>(value) << \"m\";\n\t}\n#else\n\ttemplate <typename T>\n\tinline enableStd<T> setColor(std::ostream &os, T const value)\n\t{\n\t\treturn os << \"\\033[\" << static_cast<int>(value) << \"m\";\n\t}\n#endif\n\n\ttemplate <typename T>\n\tusing enableControl =\n\t  typename std::enable_if<std::is_same<T, rang::control>::value,\n\t    std::ostream &>::type;\n}\n\n\nvoid init()\n{\n\trang_implementation::RANG_coutbuf();\n\trang_implementation::RANG_cerrbuf();\n\trang_implementation::RANG_clogbuf();\n}\n\n\ntemplate <typename T>\ninline rang_implementation::enableStd<T> operator<<(\n  std::ostream &os, T const value)\n{\n\tconst int option = rang_implementation::controlValue();\n\tswitch (option) {\n\t\tcase 0: return os;\n\t\tcase 1:\n\t\t\treturn rang_implementation::supportsColor()\n\t\t\t    && rang_implementation::isTerminal(os.rdbuf())\n\t\t\t  ? rang_implementation::setColor(os, value)\n\t\t\t  : os;\n\t\tcase 2: return rang_implementation::setColor(os, value);\n\t\tdefault: return os;\n\t}\n}\n\n\ntemplate <typename T>\ninline rang_implementation::enableControl<T> operator<<(\n  std::ostream &os, T const value)\n{\n\tif (value == rang::control::offColor) {\n\t\trang_implementation::controlValue() = 0;\n\t} else if (value == rang::control::autoColor) {\n\t\trang_implementation::controlValue() = 1;\n\t} else if (value == rang::control::forceColor) {\n\t\trang_implementation::controlValue() = 2;\n\t}\n\treturn os;\n}\n}\n\n#undef OS_LINUX\n#undef OS_WIN\n#undef OS_MAC\n\n#endif /* ifndef RANG_DOT_HPP */\n","filetypes":["cpp"]}},"line_num":9,"column_num":9,"command_arguments":["FixIt"],"completer_target":"filetype_default"}
[buildRequest] document, /home/agauniyal/projects/rang/include/rang.hpp; position: [object Object]; event: null
[_request] {"filepath":"/home/agauniyal/projects/rang/include/rang.hpp","working_dir":"/home/agauniyal/projects/rang","file_data":{"/home/agauniyal/projects/rang/include/rang.hpp":{"contents":"#ifndef RANG_DOT_HPP\n#define RANG_DOT_HPP\n\n#if defined(__unix__) || defined(__unix) || defined(__linux__)\n#define OS_LINUX\n#elif defined(WIN32) || defined(_WIN32) || defined(_WIN64)\n#define OS_WIN\n#elif defined(__APPLE__) || defined(__MACH__)\n#define OS_MAC\n#else\n#error Unknown Platform\n#endif\n\n#if defined(OS_LINUX) || defined(OS_MAC)\n#include <unistd.h>\n#include <cstring>\n#elif defined(OS_WIN)\n#include <windows.h>\n#include <io.h>\n#include <VersionHelpers.h>\n#endif\n\n#include <algorithm>\n#include <cstdlib>\n#include <ios>\n#include <iostream>\n#include <iterator>\n#include <type_traits>\n#include <atomic>\n\nnamespace rang {\n\nenum class style {\n\treset     = 0,\n\tbold      = 1,\n\tdim       = 2,\n\titalic    = 3,\n\tunderline = 4,\n\tblink     = 5,\n\trblink    = 6,\n\treversed  = 7,\n\tconceal   = 8,\n\tcrossed   = 9\n};\n\nenum class fg {\n\tblack   = 30,\n\tred     = 31,\n\tgreen   = 32,\n\tyellow  = 33,\n\tblue    = 34,\n\tmagenta = 35,\n\tcyan    = 36,\n\tgray    = 37,\n\treset   = 39\n};\n\nenum class bg {\n\tblack   = 40,\n\tred     = 41,\n\tgreen   = 42,\n\tyellow  = 43,\n\tblue    = 44,\n\tmagenta = 45,\n\tcyan    = 46,\n\tgray    = 47,\n\treset   = 49\n};\n\nenum class fgB {\n\tblack   = 90,\n\tred     = 91,\n\tgreen   = 92,\n\tyellow  = 93,\n\tblue    = 94,\n\tmagenta = 95,\n\tcyan    = 96,\n\tgray    = 97\n};\n\nenum class bgB {\n\tblack   = 100,\n\tred     = 101,\n\tgreen   = 102,\n\tyellow  = 103,\n\tblue    = 104,\n\tmagenta = 105,\n\tcyan    = 106,\n\tgray    = 107\n};\n\nenum class control { offColor = 0, autoColor = 1, forceColor = 2 };\n\n\nnamespace rang_implementation {\n\n\n\tinline std::streambuf const *&RANG_coutbuf()\n\t{\n\t\tstatic std::streambuf const *pOutbuff = std::cout.rdbuf();\n\t\treturn pOutbuff;\n\t}\n\n\tinline std::streambuf const *&RANG_cerrbuf()\n\t{\n\t\tstatic std::streambuf const *pErrbuff = std::cerr.rdbuf();\n\t\treturn pErrbuff;\n\t}\n\n\tinline std::streambuf const *&RANG_clogbuf()\n\t{\n\t\tstatic std::streambuf const *pLogbuff = std::clog.rdbuf();\n\t\treturn pLogbuff;\n\t}\n\n\n\tinline std::atomic<int> &controlValue()\n\t{\n\t\tstatic std::atomic<int> value(1);\n\t\treturn value;\n\t}\n\n\n\tinline bool supportsColor()\n\t{\n#if defined(OS_LINUX) || defined(OS_MAC)\n\t\tstatic constexpr const char *Terms[] = {\n\t\t\t\"ansi\", \"color\", \"console\", \"cygwin\", \"gnome\", \"konsole\", \"kterm\",\n\t\t\t\"linux\", \"msys\", \"putty\", \"rxvt\", \"screen\", \"vt100\", \"xterm\"\n\t\t};\n\n\t\tstatic const char *env_p = std::getenv(\"TERM\");\n\n\t\tstatic const bool result = (env_p == nullptr)\n\t\t  ? false\n\t\t  : std::any_of(\n\t\t      std::begin(Terms), std::end(Terms), [](const char *term) {\n\t\t\t      return std::strstr(env_p, term) != nullptr;\n\t\t\t  });\n\n#elif defined(OS_WIN)\n\t\tstatic constexpr bool result = true;\n#endif\n\t\treturn result;\n\t}\n\n\n\tinline bool isTerminal(const std::streambuf *osbuf)\n\t{\n\t\tif (osbuf == RANG_coutbuf()) {\n#if defined(OS_LINUX) || defined(OS_MAC)\n\t\t\treturn isatty(fileno(stdout)) ? true : false;\n#elif defined(OS_WIN)\n\t\t\treturn _isatty(_fileno(stdout)) ? true : false;\n#endif\n\t\t}\n\n\t\tif (osbuf == RANG_cerrbuf() || osbuf == RANG_clogbuf()) {\n#if defined(OS_LINUX) || defined(OS_MAC)\n\t\t\treturn isatty(fileno(stderr)) ? true : false;\n#elif defined(OS_WIN)\n\t\t\treturn _isatty(_fileno(stderr)) ? true : false;\n#endif\n\t\t}\n\t\treturn false;\n\t}\n\n\n\ttemplate <typename T>\n\tusing enableStd =\n\t  typename std::enable_if<std::is_same<T, rang::style>::value\n\t      || std::is_same<T, rang::fg>::value\n\t      || std::is_same<T, rang::bg>::value\n\t      || std::is_same<T, rang::fgB>::value\n\t      || std::is_same<T, rang::bgB>::value,\n\t    std::ostream &>::type;\n\n\n#ifdef OS_WIN\n\tHANDLE getVersionDependentHandle()\n\t{\n\t\tif (IsWindowsVersionOrGreater(10, 0, 0)) return nullptr;\n\t\treturn GetStdHandle(STD_OUTPUT_HANDLE);\n\t}\n\n\tinline HANDLE getConsoleHandle()\n\t{\n\t\tstatic HANDLE h = getVersionDependentHandle();\n\t\treturn h;\n\t}\n\n\tinline WORD reverseRGB(WORD rgb)\n\t{\n\t\tstatic const WORD rev[8] = { 0, 4, 2, 6, 1, 5, 3, 7 };\n\t\treturn rev[rgb];\n\t}\n\n\tinline void setWinAttribute(rang::bg col, WORD &state)\n\t{\n\t\tstate &= 0xFF0F;\n\t\tstate |= reverseRGB(static_cast<WORD>(col) - 40) << 4;\n\t}\n\n\tinline void setWinAttribute(rang::fg col, WORD &state)\n\t{\n\t\tstate &= 0xFFF0;\n\t\tstate |= reverseRGB(static_cast<WORD>(col) - 30);\n\t}\n\n\tinline void setWinAttribute(rang::bgB col, WORD &state)\n\t{\n\t\tstate &= 0xFF0F;\n\t\tstate |= (0x8 | reverseRGB(static_cast<WORD>(col) - 100)) << 4;\n\t}\n\n\tinline void setWinAttribute(rang::fgB col, WORD &state)\n\t{\n\t\tstate &= 0xFFF0;\n\t\tstate |= (0x8 | reverseRGB(static_cast<WORD>(col) - 90));\n\t}\n\n\tinline void setWinAttribute(rang::style style, WORD &state)\n\t{\n\t\tif (style == rang::style::reset) {\n\t\t\tstate = (FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED);\n\t\t}\n\t}\n\n\tinline WORD &current_state()\n\t{\n\t\tstatic WORD state\n\t\t  = (FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED);\n\t\treturn state;\n\t}\n\n\n\ttemplate <typename T>\n\tinline enableStd<T> setColor(std::ostream &os, T const value)\n\t{\n\t\tHANDLE h = getConsoleHandle();\n\t\tif (h && isTerminal(os.rdbuf())) {\n\t\t\tsetWinAttribute(value, current_state());\n\t\t\tSetConsoleTextAttribute(h, current_state());\n\t\t\treturn os;\n\t\t}\n\t\treturn os << \"\\033[\" << static_cast<int>(value) << \"m\";\n\t}\n#else\n\ttemplate <typename T>\n\tinline enableStd<T> setColor(std::ostream &os, T const value)\n\t{\n\t\treturn os << \"\\033[\" << static_cast<int>(value) << \"m\";\n\t}\n#endif\n\n\ttemplate <typename T>\n\tusing enableControl =\n\t  typename std::enable_if<std::is_same<T, rang::control>::value,\n\t    std::ostream &>::type;\n}\n\n\nvoid init()\n{\n\trang_implementation::RANG_coutbuf();\n\trang_implementation::RANG_cerrbuf();\n\trang_implementation::RANG_clogbuf();\n}\n\n\ntemplate <typename T>\ninline rang_implementation::enableStd<T> operator<<(\n  std::ostream &os, T const value)\n{\n\tconst int option = rang_implementation::controlValue();\n\tswitch (option) {\n\t\tcase 0: return os;\n\t\tcase 1:\n\t\t\treturn rang_implementation::supportsColor()\n\t\t\t    && rang_implementation::isTerminal(os.rdbuf())\n\t\t\t  ? rang_implementation::setColor(os, value)\n\t\t\t  : os;\n\t\tcase 2: return rang_implementation::setColor(os, value);\n\t\tdefault: return os;\n\t}\n}\n\n\ntemplate <typename T>\ninline rang_implementation::enableControl<T> operator<<(\n  std::ostream &os, T const value)\n{\n\tif (value == rang::control::offColor) {\n\t\trang_implementation::controlValue() = 0;\n\t} else if (value == rang::control::autoColor) {\n\t\trang_implementation::controlValue() = 1;\n\t} else if (value == rang::control::forceColor) {\n\t\trang_implementation::controlValue() = 2;\n\t}\n\treturn os;\n}\n}\n\n#undef OS_LINUX\n#undef OS_WIN\n#undef OS_MAC\n\n#endif /* ifndef RANG_DOT_HPP */\n","filetypes":["cpp"]}},"line_num":9,"column_num":9,"command_arguments":["FixIt"],"completer_target":"filetype_default"}
events.js:160
      throw er; // Unhandled 'error' event
      ^

Error: connect ECONNREFUSED 127.0.0.1:43415
    at Object.exports._errnoException (util.js:1026:11)
    at exports._exceptionWithHostPort (util.js:1049:20)
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1081:14)
[Info  - 1:01:44 PM] Connection to server got closed. Server will restart.
[onDidChangeConfiguration settings] {"ycmd":{"confirm_extra_conf":true,"debug":true,"enabled_languages":["cpp","c"],"global_extra_config":"/home/agauniyal/.vim/.ycm_extra_conf.py","path":"/home/agauniyal/.vim/plugged/YouCompleteMe/third_party/ycmd","python":"/usr/bin/python2","use_imprecise_get_type":true}}
[getInstance] ycm is restarting
[onDidOpen] file:///home/agauniyal/projects/rang/include/rang.hpp
[getInstance] ycm is initializing, delay 200ms...
[onDidChangeContent "file:///home/agauniyal/projects/rang/include/rang.hpp"]
[getInstance] ycm is initializing, delay 200ms...
[onCodeAction] {"textDocument":{"uri":"file:///home/agauniyal/projects/rang/include/rang.hpp"},"range":{"start":{"line":8,"character":8},"end":{"line":8,"character":14}},"context":{"diagnostics":[]}}
[getInstance] ycm is initializing, delay 200ms...
[onCodeAction] {"textDocument":{"uri":"file:///home/agauniyal/projects/rang/include/rang.hpp"},"range":{"start":{"line":8,"character":8},"end":{"line":8,"character":14}},"context":{"diagnostics":[]}}
[getInstance] ycm is initializing, delay 200ms...
[onCodeAction] {"textDocument":{"uri":"file:///home/agauniyal/projects/rang/include/rang.hpp"},"range":{"start":{"line":8,"character":8},"end":{"line":8,"character":14}},"context":{"diagnostics":[]}}
[getInstance] ycm is initializing, delay 200ms...
[onCodeAction] {"textDocument":{"uri":"file:///home/agauniyal/projects/rang/include/rang.hpp"},"range":{"start":{"line":8,"character":8},"end":{"line":8,"character":14}},"context":{"diagnostics":[]}}
[getInstance] ycm is initializing, delay 200ms...
[start] unused port: 37269
[start] random secret: 24e4f86a0c1b4a8d3128e8db7a8d8b19
[start] default options: {"filepath_completion_use_working_dir":0,"auto_trigger":1,"min_num_of_chars_for_completion":2,"min_num_identifier_candidate_chars":0,"semantic_triggers":{},"filetype_specific_completion_to_disable":{"gitcommit":1},"seed_identifiers_with_syntax":0,"collect_identifiers_from_comments_and_strings":0,"collect_identifiers_from_tags_files":0,"max_num_identifier_candidates":10,"extra_conf_globlist":[],"global_ycm_extra_conf":"","confirm_extra_conf":1,"complete_in_comments":0,"complete_in_strings":1,"max_diagnostics_to_display":30,"filetype_whitelist":{"*":1},"filetype_blacklist":{"tagbar":1,"qf":1,"notes":1,"markdown":1,"netrw":1,"unite":1,"text":1,"vimwiki":1,"pandoc":1,"infolog":1,"mail":1},"auto_start_csharp_server":1,"auto_stop_csharp_server":1,"use_ultisnips_completer":1,"csharp_server_port":0,"hmac_secret":"","server_keep_logfiles":0,"gocode_binary_path":"","godef_binary_path":"","rust_src_path":"","racerd_binary_path":"","python_binary_path":""}
[processData: {"filepath_completion_use_working_dir":0,"auto_trigger":1,"min_num_of_chars_for_completion":2,"min_num_identifier_candidate_chars":0,"semantic_triggers":{},"filetype_specific_completion_to_disable":{"gitcommit":1},"seed_identifiers_with_syntax":0,"collect_identifiers_from_comments_and_strings":0,"collect_identifiers_from_tags_files":0,"max_num_identifier_candidates":10,"extra_conf_globlist":[],"global_ycm_extra_conf":"/home/agauniyal/.vim/.ycm_extra_conf.py","confirm_extra_conf":true,"complete_in_comments":0,"complete_in_strings":1,"max_diagnostics_to_display":30,"filetype_whitelist":{"*":1},"filetype_blacklist":{"tagbar":1,"qf":1,"notes":1,"markdown":1,"netrw":1,"unite":1,"text":1,"vimwiki":1,"pandoc":1,"infolog":1,"mail":1},"auto_start_csharp_server":1,"auto_stop_csharp_server":1,"use_ultisnips_completer":1,"csharp_server_port":0,"hmac_secret":"JOT4agwbSo0xKOjbeo2LGQ==","server_keep_logfiles":0,"gocode_binary_path":"","godef_binary_path":"","rust_src_path":"","racerd_binary_path":"","python_binary_path":"","rustSrcPath":""}]
[start] optionsFile: /tmp/VSCodeYcmOptions-1489217504824
[_start] [ '/home/agauniyal/.vim/plugged/YouCompleteMe/third_party/ycmd/ycmd',
  '--port=37269',
  '--options_file=/tmp/VSCodeYcmOptions-1489217504824',
  '--idle_suicide_seconds=600' ]
[_start] process spawn success 3944
[getInstance] ycm is initializing, delay 200ms...
[getInstance] ycm is initializing, delay 200ms...
[getInstance] ycm is initializing, delay 200ms...
[getInstance] ycm is initializing, delay 200ms...
[getInstance] ycm is initializing, delay 200ms...
[getInstance] ycm is initializing, delay 200ms...
[getInstance] ycm is initializing, delay 200ms...
[getInstance] ycm is initializing, delay 200ms...
[getInstance] ycm is initializing, delay 200ms...
[getInstance] ycm is initializing, delay 200ms...
[getInstance] ycm is initializing, delay 200ms...
[getInstance] ycm is initializing, delay 200ms...
[getInstance] ycm is initializing, delay 200ms...
[getInstance] ycm is initializing, delay 200ms...
[getInstance] ycm is initializing, delay 200ms...
[getInstance] ycm is initializing, delay 200ms...
[getInstance] ycm is initializing, delay 200ms...
[getInstance] ycm is initializing, delay 200ms...
[getInstance] ycm is initializing, delay 200ms...
[getInstance] ycm is initializing, delay 200ms...
[getInstance] ycm is initializing, delay 200ms...
[getInstance] ycm is initializing, delay 200ms...
[getInstance] ycm is initializing, delay 200ms...
[getInstance] ycm is initializing, delay 200ms...
[getInstance] ycm is initializing, delay 200ms...
[getInstance] ycm is initializing, delay 200ms...
[getInstance] ycm is initializing, delay 200ms...
[getInstance] ycm is initializing, delay 200ms...
[getInstance] ycm is initializing, delay 200ms...
[getInstance] ycm is initializing, delay 200ms...
[start] ycm started: 3944
[buildRequest] document, /home/agauniyal/projects/rang/include/rang.hpp; position: null; event: BufferVisit
[_request] {"filepath":"/home/agauniyal/projects/rang/include/rang.hpp","working_dir":"/home/agauniyal/projects/rang","file_data":{"/home/agauniyal/projects/rang/include/rang.hpp":{"contents":"#ifndef RANG_DOT_HPP\n#define RANG_DOT_HPP\n\n#if defined(__unix__) || defined(__unix) || defined(__linux__)\n#define OS_LINUX\n#elif defined(WIN32) || defined(_WIN32) || defined(_WIN64)\n#define OS_WIN\n#elif defined(__APPLE__) || defined(__MACH__)\n#define OS_MAC\n#else\n#error Unknown Platform\n#endif\n\n#if defined(OS_LINUX) || defined(OS_MAC)\n#include <unistd.h>\n#include <cstring>\n#elif defined(OS_WIN)\n#include <windows.h>\n#include <io.h>\n#include <VersionHelpers.h>\n#endif\n\n#include <algorithm>\n#include <cstdlib>\n#include <ios>\n#include <iostream>\n#include <iterator>\n#include <type_traits>\n#include <atomic>\n\nnamespace rang {\n\nenum class style {\n\treset     = 0,\n\tbold      = 1,\n\tdim       = 2,\n\titalic    = 3,\n\tunderline = 4,\n\tblink     = 5,\n\trblink    = 6,\n\treversed  = 7,\n\tconceal   = 8,\n\tcrossed   = 9\n};\n\nenum class fg {\n\tblack   = 30,\n\tred     = 31,\n\tgreen   = 32,\n\tyellow  = 33,\n\tblue    = 34,\n\tmagenta = 35,\n\tcyan    = 36,\n\tgray    = 37,\n\treset   = 39\n};\n\nenum class bg {\n\tblack   = 40,\n\tred     = 41,\n\tgreen   = 42,\n\tyellow  = 43,\n\tblue    = 44,\n\tmagenta = 45,\n\tcyan    = 46,\n\tgray    = 47,\n\treset   = 49\n};\n\nenum class fgB {\n\tblack   = 90,\n\tred     = 91,\n\tgreen   = 92,\n\tyellow  = 93,\n\tblue    = 94,\n\tmagenta = 95,\n\tcyan    = 96,\n\tgray    = 97\n};\n\nenum class bgB {\n\tblack   = 100,\n\tred     = 101,\n\tgreen   = 102,\n\tyellow  = 103,\n\tblue    = 104,\n\tmagenta = 105,\n\tcyan    = 106,\n\tgray    = 107\n};\n\nenum class control { offColor = 0, autoColor = 1, forceColor = 2 };\n\n\nnamespace rang_implementation {\n\n\n\tinline std::streambuf const *&RANG_coutbuf()\n\t{\n\t\tstatic std::streambuf const *pOutbuff = std::cout.rdbuf();\n\t\treturn pOutbuff;\n\t}\n\n\tinline std::streambuf const *&RANG_cerrbuf()\n\t{\n\t\tstatic std::streambuf const *pErrbuff = std::cerr.rdbuf();\n\t\treturn pErrbuff;\n\t}\n\n\tinline std::streambuf const *&RANG_clogbuf()\n\t{\n\t\tstatic std::streambuf const *pLogbuff = std::clog.rdbuf();\n\t\treturn pLogbuff;\n\t}\n\n\n\tinline std::atomic<int> &controlValue()\n\t{\n\t\tstatic std::atomic<int> value(1);\n\t\treturn value;\n\t}\n\n\n\tinline bool supportsColor()\n\t{\n#if defined(OS_LINUX) || defined(OS_MAC)\n\t\tstatic constexpr const char *Terms[] = {\n\t\t\t\"ansi\", \"color\", \"console\", \"cygwin\", \"gnome\", \"konsole\", \"kterm\",\n\t\t\t\"linux\", \"msys\", \"putty\", \"rxvt\", \"screen\", \"vt100\", \"xterm\"\n\t\t};\n\n\t\tstatic const char *env_p = std::getenv(\"TERM\");\n\n\t\tstatic const bool result = (env_p == nullptr)\n\t\t  ? false\n\t\t  : std::any_of(\n\t\t      std::begin(Terms), std::end(Terms), [](const char *term) {\n\t\t\t      return std::strstr(env_p, term) != nullptr;\n\t\t\t  });\n\n#elif defined(OS_WIN)\n\t\tstatic constexpr bool result = true;\n#endif\n\t\treturn result;\n\t}\n\n\n\tinline bool isTerminal(const std::streambuf *osbuf)\n\t{\n\t\tif (osbuf == RANG_coutbuf()) {\n#if defined(OS_LINUX) || defined(OS_MAC)\n\t\t\treturn isatty(fileno(stdout)) ? true : false;\n#elif defined(OS_WIN)\n\t\t\treturn _isatty(_fileno(stdout)) ? true : false;\n#endif\n\t\t}\n\n\t\tif (osbuf == RANG_cerrbuf() || osbuf == RANG_clogbuf()) {\n#if defined(OS_LINUX) || defined(OS_MAC)\n\t\t\treturn isatty(fileno(stderr)) ? true : false;\n#elif defined(OS_WIN)\n\t\t\treturn _isatty(_fileno(stderr)) ? true : false;\n#endif\n\t\t}\n\t\treturn false;\n\t}\n\n\n\ttemplate <typename T>\n\tusing enableStd =\n\t  typename std::enable_if<std::is_same<T, rang::style>::value\n\t      || std::is_same<T, rang::fg>::value\n\t      || std::is_same<T, rang::bg>::value\n\t      || std::is_same<T, rang::fgB>::value\n\t      || std::is_same<T, rang::bgB>::value,\n\t    std::ostream &>::type;\n\n\n#ifdef OS_WIN\n\tHANDLE getVersionDependentHandle()\n\t{\n\t\tif (IsWindowsVersionOrGreater(10, 0, 0)) return nullptr;\n\t\treturn GetStdHandle(STD_OUTPUT_HANDLE);\n\t}\n\n\tinline HANDLE getConsoleHandle()\n\t{\n\t\tstatic HANDLE h = getVersionDependentHandle();\n\t\treturn h;\n\t}\n\n\tinline WORD reverseRGB(WORD rgb)\n\t{\n\t\tstatic const WORD rev[8] = { 0, 4, 2, 6, 1, 5, 3, 7 };\n\t\treturn rev[rgb];\n\t}\n\n\tinline void setWinAttribute(rang::bg col, WORD &state)\n\t{\n\t\tstate &= 0xFF0F;\n\t\tstate |= reverseRGB(static_cast<WORD>(col) - 40) << 4;\n\t}\n\n\tinline void setWinAttribute(rang::fg col, WORD &state)\n\t{\n\t\tstate &= 0xFFF0;\n\t\tstate |= reverseRGB(static_cast<WORD>(col) - 30);\n\t}\n\n\tinline void setWinAttribute(rang::bgB col, WORD &state)\n\t{\n\t\tstate &= 0xFF0F;\n\t\tstate |= (0x8 | reverseRGB(static_cast<WORD>(col) - 100)) << 4;\n\t}\n\n\tinline void setWinAttribute(rang::fgB col, WORD &state)\n\t{\n\t\tstate &= 0xFFF0;\n\t\tstate |= (0x8 | reverseRGB(static_cast<WORD>(col) - 90));\n\t}\n\n\tinline void setWinAttribute(rang::style style, WORD &state)\n\t{\n\t\tif (style == rang::style::reset) {\n\t\t\tstate = (FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED);\n\t\t}\n\t}\n\n\tinline WORD &current_state()\n\t{\n\t\tstatic WORD state\n\t\t  = (FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED);\n\t\treturn state;\n\t}\n\n\n\ttemplate <typename T>\n\tinline enableStd<T> setColor(std::ostream &os, T const value)\n\t{\n\t\tHANDLE h = getConsoleHandle();\n\t\tif (h && isTerminal(os.rdbuf())) {\n\t\t\tsetWinAttribute(value, current_state());\n\t\t\tSetConsoleTextAttribute(h, current_state());\n\t\t\treturn os;\n\t\t}\n\t\treturn os << \"\\033[\" << static_cast<int>(value) << \"m\";\n\t}\n#else\n\ttemplate <typename T>\n\tinline enableStd<T> setColor(std::ostream &os, T const value)\n\t{\n\t\treturn os << \"\\033[\" << static_cast<int>(value) << \"m\";\n\t}\n#endif\n\n\ttemplate <typename T>\n\tusing enableControl =\n\t  typename std::enable_if<std::is_same<T, rang::control>::value,\n\t    std::ostream &>::type;\n}\n\n\nvoid init()\n{\n\trang_implementation::RANG_coutbuf();\n\trang_implementation::RANG_cerrbuf();\n\trang_implementation::RANG_clogbuf();\n}\n\n\ntemplate <typename T>\ninline rang_implementation::enableStd<T> operator<<(\n  std::ostream &os, T const value)\n{\n\tconst int option = rang_implementation::controlValue();\n\tswitch (option) {\n\t\tcase 0: return os;\n\t\tcase 1:\n\t\t\treturn rang_implementation::supportsColor()\n\t\t\t    && rang_implementation::isTerminal(os.rdbuf())\n\t\t\t  ? rang_implementation::setColor(os, value)\n\t\t\t  : os;\n\t\tcase 2: return rang_implementation::setColor(os, value);\n\t\tdefault: return os;\n\t}\n}\n\n\ntemplate <typename T>\ninline rang_implementation::enableControl<T> operator<<(\n  std::ostream &os, T const value)\n{\n\tif (value == rang::control::offColor) {\n\t\trang_implementation::controlValue() = 0;\n\t} else if (value == rang::control::autoColor) {\n\t\trang_implementation::controlValue() = 1;\n\t} else if (value == rang::control::forceColor) {\n\t\trang_implementation::controlValue() = 2;\n\t}\n\treturn os;\n}\n}\n\n#undef OS_LINUX\n#undef OS_WIN\n#undef OS_MAC\n\n#endif /* ifndef RANG_DOT_HPP */\n","filetypes":["cpp"]}},"line_num":1,"column_num":1,"event_name":"BufferVisit"}
[buildRequest] document, /home/agauniyal/projects/rang/include/rang.hpp; position: [object Object]; event: null
[_request] {"filepath":"/home/agauniyal/projects/rang/include/rang.hpp","working_dir":"/home/agauniyal/projects/rang","file_data":{"/home/agauniyal/projects/rang/include/rang.hpp":{"contents":"#ifndef RANG_DOT_HPP\n#define RANG_DOT_HPP\n\n#if defined(__unix__) || defined(__unix) || defined(__linux__)\n#define OS_LINUX\n#elif defined(WIN32) || defined(_WIN32) || defined(_WIN64)\n#define OS_WIN\n#elif defined(__APPLE__) || defined(__MACH__)\n#define OS_MAC\n#else\n#error Unknown Platform\n#endif\n\n#if defined(OS_LINUX) || defined(OS_MAC)\n#include <unistd.h>\n#include <cstring>\n#elif defined(OS_WIN)\n#include <windows.h>\n#include <io.h>\n#include <VersionHelpers.h>\n#endif\n\n#include <algorithm>\n#include <cstdlib>\n#include <ios>\n#include <iostream>\n#include <iterator>\n#include <type_traits>\n#include <atomic>\n\nnamespace rang {\n\nenum class style {\n\treset     = 0,\n\tbold      = 1,\n\tdim       = 2,\n\titalic    = 3,\n\tunderline = 4,\n\tblink     = 5,\n\trblink    = 6,\n\treversed  = 7,\n\tconceal   = 8,\n\tcrossed   = 9\n};\n\nenum class fg {\n\tblack   = 30,\n\tred     = 31,\n\tgreen   = 32,\n\tyellow  = 33,\n\tblue    = 34,\n\tmagenta = 35,\n\tcyan    = 36,\n\tgray    = 37,\n\treset   = 39\n};\n\nenum class bg {\n\tblack   = 40,\n\tred     = 41,\n\tgreen   = 42,\n\tyellow  = 43,\n\tblue    = 44,\n\tmagenta = 45,\n\tcyan    = 46,\n\tgray    = 47,\n\treset   = 49\n};\n\nenum class fgB {\n\tblack   = 90,\n\tred     = 91,\n\tgreen   = 92,\n\tyellow  = 93,\n\tblue    = 94,\n\tmagenta = 95,\n\tcyan    = 96,\n\tgray    = 97\n};\n\nenum class bgB {\n\tblack   = 100,\n\tred     = 101,\n\tgreen   = 102,\n\tyellow  = 103,\n\tblue    = 104,\n\tmagenta = 105,\n\tcyan    = 106,\n\tgray    = 107\n};\n\nenum class control { offColor = 0, autoColor = 1, forceColor = 2 };\n\n\nnamespace rang_implementation {\n\n\n\tinline std::streambuf const *&RANG_coutbuf()\n\t{\n\t\tstatic std::streambuf const *pOutbuff = std::cout.rdbuf();\n\t\treturn pOutbuff;\n\t}\n\n\tinline std::streambuf const *&RANG_cerrbuf()\n\t{\n\t\tstatic std::streambuf const *pErrbuff = std::cerr.rdbuf();\n\t\treturn pErrbuff;\n\t}\n\n\tinline std::streambuf const *&RANG_clogbuf()\n\t{\n\t\tstatic std::streambuf const *pLogbuff = std::clog.rdbuf();\n\t\treturn pLogbuff;\n\t}\n\n\n\tinline std::atomic<int> &controlValue()\n\t{\n\t\tstatic std::atomic<int> value(1);\n\t\treturn value;\n\t}\n\n\n\tinline bool supportsColor()\n\t{\n#if defined(OS_LINUX) || defined(OS_MAC)\n\t\tstatic constexpr const char *Terms[] = {\n\t\t\t\"ansi\", \"color\", \"console\", \"cygwin\", \"gnome\", \"konsole\", \"kterm\",\n\t\t\t\"linux\", \"msys\", \"putty\", \"rxvt\", \"screen\", \"vt100\", \"xterm\"\n\t\t};\n\n\t\tstatic const char *env_p = std::getenv(\"TERM\");\n\n\t\tstatic const bool result = (env_p == nullptr)\n\t\t  ? false\n\t\t  : std::any_of(\n\t\t      std::begin(Terms), std::end(Terms), [](const char *term) {\n\t\t\t      return std::strstr(env_p, term) != nullptr;\n\t\t\t  });\n\n#elif defined(OS_WIN)\n\t\tstatic constexpr bool result = true;\n#endif\n\t\treturn result;\n\t}\n\n\n\tinline bool isTerminal(const std::streambuf *osbuf)\n\t{\n\t\tif (osbuf == RANG_coutbuf()) {\n#if defined(OS_LINUX) || defined(OS_MAC)\n\t\t\treturn isatty(fileno(stdout)) ? true : false;\n#elif defined(OS_WIN)\n\t\t\treturn _isatty(_fileno(stdout)) ? true : false;\n#endif\n\t\t}\n\n\t\tif (osbuf == RANG_cerrbuf() || osbuf == RANG_clogbuf()) {\n#if defined(OS_LINUX) || defined(OS_MAC)\n\t\t\treturn isatty(fileno(stderr)) ? true : false;\n#elif defined(OS_WIN)\n\t\t\treturn _isatty(_fileno(stderr)) ? true : false;\n#endif\n\t\t}\n\t\treturn false;\n\t}\n\n\n\ttemplate <typename T>\n\tusing enableStd =\n\t  typename std::enable_if<std::is_same<T, rang::style>::value\n\t      || std::is_same<T, rang::fg>::value\n\t      || std::is_same<T, rang::bg>::value\n\t      || std::is_same<T, rang::fgB>::value\n\t      || std::is_same<T, rang::bgB>::value,\n\t    std::ostream &>::type;\n\n\n#ifdef OS_WIN\n\tHANDLE getVersionDependentHandle()\n\t{\n\t\tif (IsWindowsVersionOrGreater(10, 0, 0)) return nullptr;\n\t\treturn GetStdHandle(STD_OUTPUT_HANDLE);\n\t}\n\n\tinline HANDLE getConsoleHandle()\n\t{\n\t\tstatic HANDLE h = getVersionDependentHandle();\n\t\treturn h;\n\t}\n\n\tinline WORD reverseRGB(WORD rgb)\n\t{\n\t\tstatic const WORD rev[8] = { 0, 4, 2, 6, 1, 5, 3, 7 };\n\t\treturn rev[rgb];\n\t}\n\n\tinline void setWinAttribute(rang::bg col, WORD &state)\n\t{\n\t\tstate &= 0xFF0F;\n\t\tstate |= reverseRGB(static_cast<WORD>(col) - 40) << 4;\n\t}\n\n\tinline void setWinAttribute(rang::fg col, WORD &state)\n\t{\n\t\tstate &= 0xFFF0;\n\t\tstate |= reverseRGB(static_cast<WORD>(col) - 30);\n\t}\n\n\tinline void setWinAttribute(rang::bgB col, WORD &state)\n\t{\n\t\tstate &= 0xFF0F;\n\t\tstate |= (0x8 | reverseRGB(static_cast<WORD>(col) - 100)) << 4;\n\t}\n\n\tinline void setWinAttribute(rang::fgB col, WORD &state)\n\t{\n\t\tstate &= 0xFFF0;\n\t\tstate |= (0x8 | reverseRGB(static_cast<WORD>(col) - 90));\n\t}\n\n\tinline void setWinAttribute(rang::style style, WORD &state)\n\t{\n\t\tif (style == rang::style::reset) {\n\t\t\tstate = (FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED);\n\t\t}\n\t}\n\n\tinline WORD &current_state()\n\t{\n\t\tstatic WORD state\n\t\t  = (FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED);\n\t\treturn state;\n\t}\n\n\n\ttemplate <typename T>\n\tinline enableStd<T> setColor(std::ostream &os, T const value)\n\t{\n\t\tHANDLE h = getConsoleHandle();\n\t\tif (h && isTerminal(os.rdbuf())) {\n\t\t\tsetWinAttribute(value, current_state());\n\t\t\tSetConsoleTextAttribute(h, current_state());\n\t\t\treturn os;\n\t\t}\n\t\treturn os << \"\\033[\" << static_cast<int>(value) << \"m\";\n\t}\n#else\n\ttemplate <typename T>\n\tinline enableStd<T> setColor(std::ostream &os, T const value)\n\t{\n\t\treturn os << \"\\033[\" << static_cast<int>(value) << \"m\";\n\t}\n#endif\n\n\ttemplate <typename T>\n\tusing enableControl =\n\t  typename std::enable_if<std::is_same<T, rang::control>::value,\n\t    std::ostream &>::type;\n}\n\n\nvoid init()\n{\n\trang_implementation::RANG_coutbuf();\n\trang_implementation::RANG_cerrbuf();\n\trang_implementation::RANG_clogbuf();\n}\n\n\ntemplate <typename T>\ninline rang_implementation::enableStd<T> operator<<(\n  std::ostream &os, T const value)\n{\n\tconst int option = rang_implementation::controlValue();\n\tswitch (option) {\n\t\tcase 0: return os;\n\t\tcase 1:\n\t\t\treturn rang_implementation::supportsColor()\n\t\t\t    && rang_implementation::isTerminal(os.rdbuf())\n\t\t\t  ? rang_implementation::setColor(os, value)\n\t\t\t  : os;\n\t\tcase 2: return rang_implementation::setColor(os, value);\n\t\tdefault: return os;\n\t}\n}\n\n\ntemplate <typename T>\ninline rang_implementation::enableControl<T> operator<<(\n  std::ostream &os, T const value)\n{\n\tif (value == rang::control::offColor) {\n\t\trang_implementation::controlValue() = 0;\n\t} else if (value == rang::control::autoColor) {\n\t\trang_implementation::controlValue() = 1;\n\t} else if (value == rang::control::forceColor) {\n\t\trang_implementation::controlValue() = 2;\n\t}\n\treturn os;\n}\n}\n\n#undef OS_LINUX\n#undef OS_WIN\n#undef OS_MAC\n\n#endif /* ifndef RANG_DOT_HPP */\n","filetypes":["cpp"]}},"line_num":9,"column_num":9,"command_arguments":["FixIt"],"completer_target":"filetype_default"}
[buildRequest] document, /home/agauniyal/projects/rang/include/rang.hpp; position: [object Object]; event: null
[_request] {"filepath":"/home/agauniyal/projects/rang/include/rang.hpp","working_dir":"/home/agauniyal/projects/rang","file_data":{"/home/agauniyal/projects/rang/include/rang.hpp":{"contents":"#ifndef RANG_DOT_HPP\n#define RANG_DOT_HPP\n\n#if defined(__unix__) || defined(__unix) || defined(__linux__)\n#define OS_LINUX\n#elif defined(WIN32) || defined(_WIN32) || defined(_WIN64)\n#define OS_WIN\n#elif defined(__APPLE__) || defined(__MACH__)\n#define OS_MAC\n#else\n#error Unknown Platform\n#endif\n\n#if defined(OS_LINUX) || defined(OS_MAC)\n#include <unistd.h>\n#include <cstring>\n#elif defined(OS_WIN)\n#include <windows.h>\n#include <io.h>\n#include <VersionHelpers.h>\n#endif\n\n#include <algorithm>\n#include <cstdlib>\n#include <ios>\n#include <iostream>\n#include <iterator>\n#include <type_traits>\n#include <atomic>\n\nnamespace rang {\n\nenum class style {\n\treset     = 0,\n\tbold      = 1,\n\tdim       = 2,\n\titalic    = 3,\n\tunderline = 4,\n\tblink     = 5,\n\trblink    = 6,\n\treversed  = 7,\n\tconceal   = 8,\n\tcrossed   = 9\n};\n\nenum class fg {\n\tblack   = 30,\n\tred     = 31,\n\tgreen   = 32,\n\tyellow  = 33,\n\tblue    = 34,\n\tmagenta = 35,\n\tcyan    = 36,\n\tgray    = 37,\n\treset   = 39\n};\n\nenum class bg {\n\tblack   = 40,\n\tred     = 41,\n\tgreen   = 42,\n\tyellow  = 43,\n\tblue    = 44,\n\tmagenta = 45,\n\tcyan    = 46,\n\tgray    = 47,\n\treset   = 49\n};\n\nenum class fgB {\n\tblack   = 90,\n\tred     = 91,\n\tgreen   = 92,\n\tyellow  = 93,\n\tblue    = 94,\n\tmagenta = 95,\n\tcyan    = 96,\n\tgray    = 97\n};\n\nenum class bgB {\n\tblack   = 100,\n\tred     = 101,\n\tgreen   = 102,\n\tyellow  = 103,\n\tblue    = 104,\n\tmagenta = 105,\n\tcyan    = 106,\n\tgray    = 107\n};\n\nenum class control { offColor = 0, autoColor = 1, forceColor = 2 };\n\n\nnamespace rang_implementation {\n\n\n\tinline std::streambuf const *&RANG_coutbuf()\n\t{\n\t\tstatic std::streambuf const *pOutbuff = std::cout.rdbuf();\n\t\treturn pOutbuff;\n\t}\n\n\tinline std::streambuf const *&RANG_cerrbuf()\n\t{\n\t\tstatic std::streambuf const *pErrbuff = std::cerr.rdbuf();\n\t\treturn pErrbuff;\n\t}\n\n\tinline std::streambuf const *&RANG_clogbuf()\n\t{\n\t\tstatic std::streambuf const *pLogbuff = std::clog.rdbuf();\n\t\treturn pLogbuff;\n\t}\n\n\n\tinline std::atomic<int> &controlValue()\n\t{\n\t\tstatic std::atomic<int> value(1);\n\t\treturn value;\n\t}\n\n\n\tinline bool supportsColor()\n\t{\n#if defined(OS_LINUX) || defined(OS_MAC)\n\t\tstatic constexpr const char *Terms[] = {\n\t\t\t\"ansi\", \"color\", \"console\", \"cygwin\", \"gnome\", \"konsole\", \"kterm\",\n\t\t\t\"linux\", \"msys\", \"putty\", \"rxvt\", \"screen\", \"vt100\", \"xterm\"\n\t\t};\n\n\t\tstatic const char *env_p = std::getenv(\"TERM\");\n\n\t\tstatic const bool result = (env_p == nullptr)\n\t\t  ? false\n\t\t  : std::any_of(\n\t\t      std::begin(Terms), std::end(Terms), [](const char *term) {\n\t\t\t      return std::strstr(env_p, term) != nullptr;\n\t\t\t  });\n\n#elif defined(OS_WIN)\n\t\tstatic constexpr bool result = true;\n#endif\n\t\treturn result;\n\t}\n\n\n\tinline bool isTerminal(const std::streambuf *osbuf)\n\t{\n\t\tif (osbuf == RANG_coutbuf()) {\n#if defined(OS_LINUX) || defined(OS_MAC)\n\t\t\treturn isatty(fileno(stdout)) ? true : false;\n#elif defined(OS_WIN)\n\t\t\treturn _isatty(_fileno(stdout)) ? true : false;\n#endif\n\t\t}\n\n\t\tif (osbuf == RANG_cerrbuf() || osbuf == RANG_clogbuf()) {\n#if defined(OS_LINUX) || defined(OS_MAC)\n\t\t\treturn isatty(fileno(stderr)) ? true : false;\n#elif defined(OS_WIN)\n\t\t\treturn _isatty(_fileno(stderr)) ? true : false;\n#endif\n\t\t}\n\t\treturn false;\n\t}\n\n\n\ttemplate <typename T>\n\tusing enableStd =\n\t  typename std::enable_if<std::is_same<T, rang::style>::value\n\t      || std::is_same<T, rang::fg>::value\n\t      || std::is_same<T, rang::bg>::value\n\t      || std::is_same<T, rang::fgB>::value\n\t      || std::is_same<T, rang::bgB>::value,\n\t    std::ostream &>::type;\n\n\n#ifdef OS_WIN\n\tHANDLE getVersionDependentHandle()\n\t{\n\t\tif (IsWindowsVersionOrGreater(10, 0, 0)) return nullptr;\n\t\treturn GetStdHandle(STD_OUTPUT_HANDLE);\n\t}\n\n\tinline HANDLE getConsoleHandle()\n\t{\n\t\tstatic HANDLE h = getVersionDependentHandle();\n\t\treturn h;\n\t}\n\n\tinline WORD reverseRGB(WORD rgb)\n\t{\n\t\tstatic const WORD rev[8] = { 0, 4, 2, 6, 1, 5, 3, 7 };\n\t\treturn rev[rgb];\n\t}\n\n\tinline void setWinAttribute(rang::bg col, WORD &state)\n\t{\n\t\tstate &= 0xFF0F;\n\t\tstate |= reverseRGB(static_cast<WORD>(col) - 40) << 4;\n\t}\n\n\tinline void setWinAttribute(rang::fg col, WORD &state)\n\t{\n\t\tstate &= 0xFFF0;\n\t\tstate |= reverseRGB(static_cast<WORD>(col) - 30);\n\t}\n\n\tinline void setWinAttribute(rang::bgB col, WORD &state)\n\t{\n\t\tstate &= 0xFF0F;\n\t\tstate |= (0x8 | reverseRGB(static_cast<WORD>(col) - 100)) << 4;\n\t}\n\n\tinline void setWinAttribute(rang::fgB col, WORD &state)\n\t{\n\t\tstate &= 0xFFF0;\n\t\tstate |= (0x8 | reverseRGB(static_cast<WORD>(col) - 90));\n\t}\n\n\tinline void setWinAttribute(rang::style style, WORD &state)\n\t{\n\t\tif (style == rang::style::reset) {\n\t\t\tstate = (FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED);\n\t\t}\n\t}\n\n\tinline WORD &current_state()\n\t{\n\t\tstatic WORD state\n\t\t  = (FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED);\n\t\treturn state;\n\t}\n\n\n\ttemplate <typename T>\n\tinline enableStd<T> setColor(std::ostream &os, T const value)\n\t{\n\t\tHANDLE h = getConsoleHandle();\n\t\tif (h && isTerminal(os.rdbuf())) {\n\t\t\tsetWinAttribute(value, current_state());\n\t\t\tSetConsoleTextAttribute(h, current_state());\n\t\t\treturn os;\n\t\t}\n\t\treturn os << \"\\033[\" << static_cast<int>(value) << \"m\";\n\t}\n#else\n\ttemplate <typename T>\n\tinline enableStd<T> setColor(std::ostream &os, T const value)\n\t{\n\t\treturn os << \"\\033[\" << static_cast<int>(value) << \"m\";\n\t}\n#endif\n\n\ttemplate <typename T>\n\tusing enableControl =\n\t  typename std::enable_if<std::is_same<T, rang::control>::value,\n\t    std::ostream &>::type;\n}\n\n\nvoid init()\n{\n\trang_implementation::RANG_coutbuf();\n\trang_implementation::RANG_cerrbuf();\n\trang_implementation::RANG_clogbuf();\n}\n\n\ntemplate <typename T>\ninline rang_implementation::enableStd<T> operator<<(\n  std::ostream &os, T const value)\n{\n\tconst int option = rang_implementation::controlValue();\n\tswitch (option) {\n\t\tcase 0: return os;\n\t\tcase 1:\n\t\t\treturn rang_implementation::supportsColor()\n\t\t\t    && rang_implementation::isTerminal(os.rdbuf())\n\t\t\t  ? rang_implementation::setColor(os, value)\n\t\t\t  : os;\n\t\tcase 2: return rang_implementation::setColor(os, value);\n\t\tdefault: return os;\n\t}\n}\n\n\ntemplate <typename T>\ninline rang_implementation::enableControl<T> operator<<(\n  std::ostream &os, T const value)\n{\n\tif (value == rang::control::offColor) {\n\t\trang_implementation::controlValue() = 0;\n\t} else if (value == rang::control::autoColor) {\n\t\trang_implementation::controlValue() = 1;\n\t} else if (value == rang::control::forceColor) {\n\t\trang_implementation::controlValue() = 2;\n\t}\n\treturn os;\n}\n}\n\n#undef OS_LINUX\n#undef OS_WIN\n#undef OS_MAC\n\n#endif /* ifndef RANG_DOT_HPP */\n","filetypes":["cpp"]}},"line_num":9,"column_num":9,"command_arguments":["FixIt"],"completer_target":"filetype_default"}
[buildRequest] document, /home/agauniyal/projects/rang/include/rang.hpp; position: [object Object]; event: null
[_request] {"filepath":"/home/agauniyal/projects/rang/include/rang.hpp","working_dir":"/home/agauniyal/projects/rang","file_data":{"/home/agauniyal/projects/rang/include/rang.hpp":{"contents":"#ifndef RANG_DOT_HPP\n#define RANG_DOT_HPP\n\n#if defined(__unix__) || defined(__unix) || defined(__linux__)\n#define OS_LINUX\n#elif defined(WIN32) || defined(_WIN32) || defined(_WIN64)\n#define OS_WIN\n#elif defined(__APPLE__) || defined(__MACH__)\n#define OS_MAC\n#else\n#error Unknown Platform\n#endif\n\n#if defined(OS_LINUX) || defined(OS_MAC)\n#include <unistd.h>\n#include <cstring>\n#elif defined(OS_WIN)\n#include <windows.h>\n#include <io.h>\n#include <VersionHelpers.h>\n#endif\n\n#include <algorithm>\n#include <cstdlib>\n#include <ios>\n#include <iostream>\n#include <iterator>\n#include <type_traits>\n#include <atomic>\n\nnamespace rang {\n\nenum class style {\n\treset     = 0,\n\tbold      = 1,\n\tdim       = 2,\n\titalic    = 3,\n\tunderline = 4,\n\tblink     = 5,\n\trblink    = 6,\n\treversed  = 7,\n\tconceal   = 8,\n\tcrossed   = 9\n};\n\nenum class fg {\n\tblack   = 30,\n\tred     = 31,\n\tgreen   = 32,\n\tyellow  = 33,\n\tblue    = 34,\n\tmagenta = 35,\n\tcyan    = 36,\n\tgray    = 37,\n\treset   = 39\n};\n\nenum class bg {\n\tblack   = 40,\n\tred     = 41,\n\tgreen   = 42,\n\tyellow  = 43,\n\tblue    = 44,\n\tmagenta = 45,\n\tcyan    = 46,\n\tgray    = 47,\n\treset   = 49\n};\n\nenum class fgB {\n\tblack   = 90,\n\tred     = 91,\n\tgreen   = 92,\n\tyellow  = 93,\n\tblue    = 94,\n\tmagenta = 95,\n\tcyan    = 96,\n\tgray    = 97\n};\n\nenum class bgB {\n\tblack   = 100,\n\tred     = 101,\n\tgreen   = 102,\n\tyellow  = 103,\n\tblue    = 104,\n\tmagenta = 105,\n\tcyan    = 106,\n\tgray    = 107\n};\n\nenum class control { offColor = 0, autoColor = 1, forceColor = 2 };\n\n\nnamespace rang_implementation {\n\n\n\tinline std::streambuf const *&RANG_coutbuf()\n\t{\n\t\tstatic std::streambuf const *pOutbuff = std::cout.rdbuf();\n\t\treturn pOutbuff;\n\t}\n\n\tinline std::streambuf const *&RANG_cerrbuf()\n\t{\n\t\tstatic std::streambuf const *pErrbuff = std::cerr.rdbuf();\n\t\treturn pErrbuff;\n\t}\n\n\tinline std::streambuf const *&RANG_clogbuf()\n\t{\n\t\tstatic std::streambuf const *pLogbuff = std::clog.rdbuf();\n\t\treturn pLogbuff;\n\t}\n\n\n\tinline std::atomic<int> &controlValue()\n\t{\n\t\tstatic std::atomic<int> value(1);\n\t\treturn value;\n\t}\n\n\n\tinline bool supportsColor()\n\t{\n#if defined(OS_LINUX) || defined(OS_MAC)\n\t\tstatic constexpr const char *Terms[] = {\n\t\t\t\"ansi\", \"color\", \"console\", \"cygwin\", \"gnome\", \"konsole\", \"kterm\",\n\t\t\t\"linux\", \"msys\", \"putty\", \"rxvt\", \"screen\", \"vt100\", \"xterm\"\n\t\t};\n\n\t\tstatic const char *env_p = std::getenv(\"TERM\");\n\n\t\tstatic const bool result = (env_p == nullptr)\n\t\t  ? false\n\t\t  : std::any_of(\n\t\t      std::begin(Terms), std::end(Terms), [](const char *term) {\n\t\t\t      return std::strstr(env_p, term) != nullptr;\n\t\t\t  });\n\n#elif defined(OS_WIN)\n\t\tstatic constexpr bool result = true;\n#endif\n\t\treturn result;\n\t}\n\n\n\tinline bool isTerminal(const std::streambuf *osbuf)\n\t{\n\t\tif (osbuf == RANG_coutbuf()) {\n#if defined(OS_LINUX) || defined(OS_MAC)\n\t\t\treturn isatty(fileno(stdout)) ? true : false;\n#elif defined(OS_WIN)\n\t\t\treturn _isatty(_fileno(stdout)) ? true : false;\n#endif\n\t\t}\n\n\t\tif (osbuf == RANG_cerrbuf() || osbuf == RANG_clogbuf()) {\n#if defined(OS_LINUX) || defined(OS_MAC)\n\t\t\treturn isatty(fileno(stderr)) ? true : false;\n#elif defined(OS_WIN)\n\t\t\treturn _isatty(_fileno(stderr)) ? true : false;\n#endif\n\t\t}\n\t\treturn false;\n\t}\n\n\n\ttemplate <typename T>\n\tusing enableStd =\n\t  typename std::enable_if<std::is_same<T, rang::style>::value\n\t      || std::is_same<T, rang::fg>::value\n\t      || std::is_same<T, rang::bg>::value\n\t      || std::is_same<T, rang::fgB>::value\n\t      || std::is_same<T, rang::bgB>::value,\n\t    std::ostream &>::type;\n\n\n#ifdef OS_WIN\n\tHANDLE getVersionDependentHandle()\n\t{\n\t\tif (IsWindowsVersionOrGreater(10, 0, 0)) return nullptr;\n\t\treturn GetStdHandle(STD_OUTPUT_HANDLE);\n\t}\n\n\tinline HANDLE getConsoleHandle()\n\t{\n\t\tstatic HANDLE h = getVersionDependentHandle();\n\t\treturn h;\n\t}\n\n\tinline WORD reverseRGB(WORD rgb)\n\t{\n\t\tstatic const WORD rev[8] = { 0, 4, 2, 6, 1, 5, 3, 7 };\n\t\treturn rev[rgb];\n\t}\n\n\tinline void setWinAttribute(rang::bg col, WORD &state)\n\t{\n\t\tstate &= 0xFF0F;\n\t\tstate |= reverseRGB(static_cast<WORD>(col) - 40) << 4;\n\t}\n\n\tinline void setWinAttribute(rang::fg col, WORD &state)\n\t{\n\t\tstate &= 0xFFF0;\n\t\tstate |= reverseRGB(static_cast<WORD>(col) - 30);\n\t}\n\n\tinline void setWinAttribute(rang::bgB col, WORD &state)\n\t{\n\t\tstate &= 0xFF0F;\n\t\tstate |= (0x8 | reverseRGB(static_cast<WORD>(col) - 100)) << 4;\n\t}\n\n\tinline void setWinAttribute(rang::fgB col, WORD &state)\n\t{\n\t\tstate &= 0xFFF0;\n\t\tstate |= (0x8 | reverseRGB(static_cast<WORD>(col) - 90));\n\t}\n\n\tinline void setWinAttribute(rang::style style, WORD &state)\n\t{\n\t\tif (style == rang::style::reset) {\n\t\t\tstate = (FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED);\n\t\t}\n\t}\n\n\tinline WORD &current_state()\n\t{\n\t\tstatic WORD state\n\t\t  = (FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED);\n\t\treturn state;\n\t}\n\n\n\ttemplate <typename T>\n\tinline enableStd<T> setColor(std::ostream &os, T const value)\n\t{\n\t\tHANDLE h = getConsoleHandle();\n\t\tif (h && isTerminal(os.rdbuf())) {\n\t\t\tsetWinAttribute(value, current_state());\n\t\t\tSetConsoleTextAttribute(h, current_state());\n\t\t\treturn os;\n\t\t}\n\t\treturn os << \"\\033[\" << static_cast<int>(value) << \"m\";\n\t}\n#else\n\ttemplate <typename T>\n\tinline enableStd<T> setColor(std::ostream &os, T const value)\n\t{\n\t\treturn os << \"\\033[\" << static_cast<int>(value) << \"m\";\n\t}\n#endif\n\n\ttemplate <typename T>\n\tusing enableControl =\n\t  typename std::enable_if<std::is_same<T, rang::control>::value,\n\t    std::ostream &>::type;\n}\n\n\nvoid init()\n{\n\trang_implementation::RANG_coutbuf();\n\trang_implementation::RANG_cerrbuf();\n\trang_implementation::RANG_clogbuf();\n}\n\n\ntemplate <typename T>\ninline rang_implementation::enableStd<T> operator<<(\n  std::ostream &os, T const value)\n{\n\tconst int option = rang_implementation::controlValue();\n\tswitch (option) {\n\t\tcase 0: return os;\n\t\tcase 1:\n\t\t\treturn rang_implementation::supportsColor()\n\t\t\t    && rang_implementation::isTerminal(os.rdbuf())\n\t\t\t  ? rang_implementation::setColor(os, value)\n\t\t\t  : os;\n\t\tcase 2: return rang_implementation::setColor(os, value);\n\t\tdefault: return os;\n\t}\n}\n\n\ntemplate <typename T>\ninline rang_implementation::enableControl<T> operator<<(\n  std::ostream &os, T const value)\n{\n\tif (value == rang::control::offColor) {\n\t\trang_implementation::controlValue() = 0;\n\t} else if (value == rang::control::autoColor) {\n\t\trang_implementation::controlValue() = 1;\n\t} else if (value == rang::control::forceColor) {\n\t\trang_implementation::controlValue() = 2;\n\t}\n\treturn os;\n}\n}\n\n#undef OS_LINUX\n#undef OS_WIN\n#undef OS_MAC\n\n#endif /* ifndef RANG_DOT_HPP */\n","filetypes":["cpp"]}},"line_num":9,"column_num":9,"command_arguments":["FixIt"],"completer_target":"filetype_default"}
[buildRequest] document, /home/agauniyal/projects/rang/include/rang.hpp; position: [object Object]; event: null
[_request] {"filepath":"/home/agauniyal/projects/rang/include/rang.hpp","working_dir":"/home/agauniyal/projects/rang","file_data":{"/home/agauniyal/projects/rang/include/rang.hpp":{"contents":"#ifndef RANG_DOT_HPP\n#define RANG_DOT_HPP\n\n#if defined(__unix__) || defined(__unix) || defined(__linux__)\n#define OS_LINUX\n#elif defined(WIN32) || defined(_WIN32) || defined(_WIN64)\n#define OS_WIN\n#elif defined(__APPLE__) || defined(__MACH__)\n#define OS_MAC\n#else\n#error Unknown Platform\n#endif\n\n#if defined(OS_LINUX) || defined(OS_MAC)\n#include <unistd.h>\n#include <cstring>\n#elif defined(OS_WIN)\n#include <windows.h>\n#include <io.h>\n#include <VersionHelpers.h>\n#endif\n\n#include <algorithm>\n#include <cstdlib>\n#include <ios>\n#include <iostream>\n#include <iterator>\n#include <type_traits>\n#include <atomic>\n\nnamespace rang {\n\nenum class style {\n\treset     = 0,\n\tbold      = 1,\n\tdim       = 2,\n\titalic    = 3,\n\tunderline = 4,\n\tblink     = 5,\n\trblink    = 6,\n\treversed  = 7,\n\tconceal   = 8,\n\tcrossed   = 9\n};\n\nenum class fg {\n\tblack   = 30,\n\tred     = 31,\n\tgreen   = 32,\n\tyellow  = 33,\n\tblue    = 34,\n\tmagenta = 35,\n\tcyan    = 36,\n\tgray    = 37,\n\treset   = 39\n};\n\nenum class bg {\n\tblack   = 40,\n\tred     = 41,\n\tgreen   = 42,\n\tyellow  = 43,\n\tblue    = 44,\n\tmagenta = 45,\n\tcyan    = 46,\n\tgray    = 47,\n\treset   = 49\n};\n\nenum class fgB {\n\tblack   = 90,\n\tred     = 91,\n\tgreen   = 92,\n\tyellow  = 93,\n\tblue    = 94,\n\tmagenta = 95,\n\tcyan    = 96,\n\tgray    = 97\n};\n\nenum class bgB {\n\tblack   = 100,\n\tred     = 101,\n\tgreen   = 102,\n\tyellow  = 103,\n\tblue    = 104,\n\tmagenta = 105,\n\tcyan    = 106,\n\tgray    = 107\n};\n\nenum class control { offColor = 0, autoColor = 1, forceColor = 2 };\n\n\nnamespace rang_implementation {\n\n\n\tinline std::streambuf const *&RANG_coutbuf()\n\t{\n\t\tstatic std::streambuf const *pOutbuff = std::cout.rdbuf();\n\t\treturn pOutbuff;\n\t}\n\n\tinline std::streambuf const *&RANG_cerrbuf()\n\t{\n\t\tstatic std::streambuf const *pErrbuff = std::cerr.rdbuf();\n\t\treturn pErrbuff;\n\t}\n\n\tinline std::streambuf const *&RANG_clogbuf()\n\t{\n\t\tstatic std::streambuf const *pLogbuff = std::clog.rdbuf();\n\t\treturn pLogbuff;\n\t}\n\n\n\tinline std::atomic<int> &controlValue()\n\t{\n\t\tstatic std::atomic<int> value(1);\n\t\treturn value;\n\t}\n\n\n\tinline bool supportsColor()\n\t{\n#if defined(OS_LINUX) || defined(OS_MAC)\n\t\tstatic constexpr const char *Terms[] = {\n\t\t\t\"ansi\", \"color\", \"console\", \"cygwin\", \"gnome\", \"konsole\", \"kterm\",\n\t\t\t\"linux\", \"msys\", \"putty\", \"rxvt\", \"screen\", \"vt100\", \"xterm\"\n\t\t};\n\n\t\tstatic const char *env_p = std::getenv(\"TERM\");\n\n\t\tstatic const bool result = (env_p == nullptr)\n\t\t  ? false\n\t\t  : std::any_of(\n\t\t      std::begin(Terms), std::end(Terms), [](const char *term) {\n\t\t\t      return std::strstr(env_p, term) != nullptr;\n\t\t\t  });\n\n#elif defined(OS_WIN)\n\t\tstatic constexpr bool result = true;\n#endif\n\t\treturn result;\n\t}\n\n\n\tinline bool isTerminal(const std::streambuf *osbuf)\n\t{\n\t\tif (osbuf == RANG_coutbuf()) {\n#if defined(OS_LINUX) || defined(OS_MAC)\n\t\t\treturn isatty(fileno(stdout)) ? true : false;\n#elif defined(OS_WIN)\n\t\t\treturn _isatty(_fileno(stdout)) ? true : false;\n#endif\n\t\t}\n\n\t\tif (osbuf == RANG_cerrbuf() || osbuf == RANG_clogbuf()) {\n#if defined(OS_LINUX) || defined(OS_MAC)\n\t\t\treturn isatty(fileno(stderr)) ? true : false;\n#elif defined(OS_WIN)\n\t\t\treturn _isatty(_fileno(stderr)) ? true : false;\n#endif\n\t\t}\n\t\treturn false;\n\t}\n\n\n\ttemplate <typename T>\n\tusing enableStd =\n\t  typename std::enable_if<std::is_same<T, rang::style>::value\n\t      || std::is_same<T, rang::fg>::value\n\t      || std::is_same<T, rang::bg>::value\n\t      || std::is_same<T, rang::fgB>::value\n\t      || std::is_same<T, rang::bgB>::value,\n\t    std::ostream &>::type;\n\n\n#ifdef OS_WIN\n\tHANDLE getVersionDependentHandle()\n\t{\n\t\tif (IsWindowsVersionOrGreater(10, 0, 0)) return nullptr;\n\t\treturn GetStdHandle(STD_OUTPUT_HANDLE);\n\t}\n\n\tinline HANDLE getConsoleHandle()\n\t{\n\t\tstatic HANDLE h = getVersionDependentHandle();\n\t\treturn h;\n\t}\n\n\tinline WORD reverseRGB(WORD rgb)\n\t{\n\t\tstatic const WORD rev[8] = { 0, 4, 2, 6, 1, 5, 3, 7 };\n\t\treturn rev[rgb];\n\t}\n\n\tinline void setWinAttribute(rang::bg col, WORD &state)\n\t{\n\t\tstate &= 0xFF0F;\n\t\tstate |= reverseRGB(static_cast<WORD>(col) - 40) << 4;\n\t}\n\n\tinline void setWinAttribute(rang::fg col, WORD &state)\n\t{\n\t\tstate &= 0xFFF0;\n\t\tstate |= reverseRGB(static_cast<WORD>(col) - 30);\n\t}\n\n\tinline void setWinAttribute(rang::bgB col, WORD &state)\n\t{\n\t\tstate &= 0xFF0F;\n\t\tstate |= (0x8 | reverseRGB(static_cast<WORD>(col) - 100)) << 4;\n\t}\n\n\tinline void setWinAttribute(rang::fgB col, WORD &state)\n\t{\n\t\tstate &= 0xFFF0;\n\t\tstate |= (0x8 | reverseRGB(static_cast<WORD>(col) - 90));\n\t}\n\n\tinline void setWinAttribute(rang::style style, WORD &state)\n\t{\n\t\tif (style == rang::style::reset) {\n\t\t\tstate = (FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED);\n\t\t}\n\t}\n\n\tinline WORD &current_state()\n\t{\n\t\tstatic WORD state\n\t\t  = (FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED);\n\t\treturn state;\n\t}\n\n\n\ttemplate <typename T>\n\tinline enableStd<T> setColor(std::ostream &os, T const value)\n\t{\n\t\tHANDLE h = getConsoleHandle();\n\t\tif (h && isTerminal(os.rdbuf())) {\n\t\t\tsetWinAttribute(value, current_state());\n\t\t\tSetConsoleTextAttribute(h, current_state());\n\t\t\treturn os;\n\t\t}\n\t\treturn os << \"\\033[\" << static_cast<int>(value) << \"m\";\n\t}\n#else\n\ttemplate <typename T>\n\tinline enableStd<T> setColor(std::ostream &os, T const value)\n\t{\n\t\treturn os << \"\\033[\" << static_cast<int>(value) << \"m\";\n\t}\n#endif\n\n\ttemplate <typename T>\n\tusing enableControl =\n\t  typename std::enable_if<std::is_same<T, rang::control>::value,\n\t    std::ostream &>::type;\n}\n\n\nvoid init()\n{\n\trang_implementation::RANG_coutbuf();\n\trang_implementation::RANG_cerrbuf();\n\trang_implementation::RANG_clogbuf();\n}\n\n\ntemplate <typename T>\ninline rang_implementation::enableStd<T> operator<<(\n  std::ostream &os, T const value)\n{\n\tconst int option = rang_implementation::controlValue();\n\tswitch (option) {\n\t\tcase 0: return os;\n\t\tcase 1:\n\t\t\treturn rang_implementation::supportsColor()\n\t\t\t    && rang_implementation::isTerminal(os.rdbuf())\n\t\t\t  ? rang_implementation::setColor(os, value)\n\t\t\t  : os;\n\t\tcase 2: return rang_implementation::setColor(os, value);\n\t\tdefault: return os;\n\t}\n}\n\n\ntemplate <typename T>\ninline rang_implementation::enableControl<T> operator<<(\n  std::ostream &os, T const value)\n{\n\tif (value == rang::control::offColor) {\n\t\trang_implementation::controlValue() = 0;\n\t} else if (value == rang::control::autoColor) {\n\t\trang_implementation::controlValue() = 1;\n\t} else if (value == rang::control::forceColor) {\n\t\trang_implementation::controlValue() = 2;\n\t}\n\treturn os;\n}\n}\n\n#undef OS_LINUX\n#undef OS_WIN\n#undef OS_MAC\n\n#endif /* ifndef RANG_DOT_HPP */\n","filetypes":["cpp"]}},"line_num":9,"column_num":9,"command_arguments":["FixIt"],"completer_target":"filetype_default"}
events.js:160
      throw er; // Unhandled 'error' event
      ^

Error: connect ECONNREFUSED 127.0.0.1:37269
    at Object.exports._errnoException (util.js:1026:11)
    at exports._exceptionWithHostPort (util.js:1049:20)
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1081:14)
[Info  - 1:01:46 PM] Connection to server got closed. Server will restart.
[onDidChangeConfiguration settings] {"ycmd":{"confirm_extra_conf":true,"debug":true,"enabled_languages":["cpp","c"],"global_extra_config":"/home/agauniyal/.vim/.ycm_extra_conf.py","path":"/home/agauniyal/.vim/plugged/YouCompleteMe/third_party/ycmd","python":"/usr/bin/python2","use_imprecise_get_type":true}}
[getInstance] ycm is restarting
[onDidOpen] file:///home/agauniyal/projects/rang/include/rang.hpp
[getInstance] ycm is initializing, delay 200ms...
[onDidChangeContent "file:///home/agauniyal/projects/rang/include/rang.hpp"]
[getInstance] ycm is initializing, delay 200ms...
[onCodeAction] {"textDocument":{"uri":"file:///home/agauniyal/projects/rang/include/rang.hpp"},"range":{"start":{"line":8,"character":8},"end":{"line":8,"character":14}},"context":{"diagnostics":[]}}
[getInstance] ycm is initializing, delay 200ms...
[onCodeAction] {"textDocument":{"uri":"file:///home/agauniyal/projects/rang/include/rang.hpp"},"range":{"start":{"line":8,"character":8},"end":{"line":8,"character":14}},"context":{"diagnostics":[]}}
[getInstance] ycm is initializing, delay 200ms...
[onCodeAction] {"textDocument":{"uri":"file:///home/agauniyal/projects/rang/include/rang.hpp"},"range":{"start":{"line":8,"character":8},"end":{"line":8,"character":14}},"context":{"diagnostics":[]}}
[getInstance] ycm is initializing, delay 200ms...
[onCodeAction] {"textDocument":{"uri":"file:///home/agauniyal/projects/rang/include/rang.hpp"},"range":{"start":{"line":8,"character":8},"end":{"line":8,"character":14}},"context":{"diagnostics":[]}}
[getInstance] ycm is initializing, delay 200ms...
[onCodeAction] {"textDocument":{"uri":"file:///home/agauniyal/projects/rang/include/rang.hpp"},"range":{"start":{"line":8,"character":8},"end":{"line":8,"character":14}},"context":{"diagnostics":[]}}
[getInstance] ycm is initializing, delay 200ms...
[start] unused port: 35627
[start] random secret: aa29e96a7f674ef137d92806e45da0be
[start] default options: {"filepath_completion_use_working_dir":0,"auto_trigger":1,"min_num_of_chars_for_completion":2,"min_num_identifier_candidate_chars":0,"semantic_triggers":{},"filetype_specific_completion_to_disable":{"gitcommit":1},"seed_identifiers_with_syntax":0,"collect_identifiers_from_comments_and_strings":0,"collect_identifiers_from_tags_files":0,"max_num_identifier_candidates":10,"extra_conf_globlist":[],"global_ycm_extra_conf":"","confirm_extra_conf":1,"complete_in_comments":0,"complete_in_strings":1,"max_diagnostics_to_display":30,"filetype_whitelist":{"*":1},"filetype_blacklist":{"tagbar":1,"qf":1,"notes":1,"markdown":1,"netrw":1,"unite":1,"text":1,"vimwiki":1,"pandoc":1,"infolog":1,"mail":1},"auto_start_csharp_server":1,"auto_stop_csharp_server":1,"use_ultisnips_completer":1,"csharp_server_port":0,"hmac_secret":"","server_keep_logfiles":0,"gocode_binary_path":"","godef_binary_path":"","rust_src_path":"","racerd_binary_path":"","python_binary_path":""}
[processData: {"filepath_completion_use_working_dir":0,"auto_trigger":1,"min_num_of_chars_for_completion":2,"min_num_identifier_candidate_chars":0,"semantic_triggers":{},"filetype_specific_completion_to_disable":{"gitcommit":1},"seed_identifiers_with_syntax":0,"collect_identifiers_from_comments_and_strings":0,"collect_identifiers_from_tags_files":0,"max_num_identifier_candidates":10,"extra_conf_globlist":[],"global_ycm_extra_conf":"/home/agauniyal/.vim/.ycm_extra_conf.py","confirm_extra_conf":true,"complete_in_comments":0,"complete_in_strings":1,"max_diagnostics_to_display":30,"filetype_whitelist":{"*":1},"filetype_blacklist":{"tagbar":1,"qf":1,"notes":1,"markdown":1,"netrw":1,"unite":1,"text":1,"vimwiki":1,"pandoc":1,"infolog":1,"mail":1},"auto_start_csharp_server":1,"auto_stop_csharp_server":1,"use_ultisnips_completer":1,"csharp_server_port":0,"hmac_secret":"qinpan9nTvE32SgG5F2gvg==","server_keep_logfiles":0,"gocode_binary_path":"","godef_binary_path":"","rust_src_path":"","racerd_binary_path":"","python_binary_path":"","rustSrcPath":""}]
[start] optionsFile: /tmp/VSCodeYcmOptions-1489217506486
[_start] [ '/home/agauniyal/.vim/plugged/YouCompleteMe/third_party/ycmd/ycmd',
  '--port=35627',
  '--options_file=/tmp/VSCodeYcmOptions-1489217506486',
  '--idle_suicide_seconds=600' ]
[_start] process spawn success 3958
[getInstance] ycm is initializing, delay 200ms...
[getInstance] ycm is initializing, delay 200ms...
[getInstance] ycm is initializing, delay 200ms...
[getInstance] ycm is initializing, delay 200ms...
[getInstance] ycm is initializing, delay 200ms...
[getInstance] ycm is initializing, delay 200ms...
[getInstance] ycm is initializing, delay 200ms...
[getInstance] ycm is initializing, delay 200ms...
[getInstance] ycm is initializing, delay 200ms...
[getInstance] ycm is initializing, delay 200ms...
[getInstance] ycm is initializing, delay 200ms...
[getInstance] ycm is initializing, delay 200ms...
[getInstance] ycm is initializing, delay 200ms...
[getInstance] ycm is initializing, delay 200ms...
[getInstance] ycm is initializing, delay 200ms...
[getInstance] ycm is initializing, delay 200ms...
[getInstance] ycm is initializing, delay 200ms...
[getInstance] ycm is initializing, delay 200ms...
[getInstance] ycm is initializing, delay 200ms...
[getInstance] ycm is initializing, delay 200ms...
[getInstance] ycm is initializing, delay 200ms...
[getInstance] ycm is initializing, delay 200ms...
[getInstance] ycm is initializing, delay 200ms...
[getInstance] ycm is initializing, delay 200ms...
[getInstance] ycm is initializing, delay 200ms...
[getInstance] ycm is initializing, delay 200ms...
[getInstance] ycm is initializing, delay 200ms...
[getInstance] ycm is initializing, delay 200ms...
[getInstance] ycm is initializing, delay 200ms...
[getInstance] ycm is initializing, delay 200ms...
[getInstance] ycm is initializing, delay 200ms...
[getInstance] ycm is initializing, delay 200ms...
[getInstance] ycm is initializing, delay 200ms...
[getInstance] ycm is initializing, delay 200ms...
[getInstance] ycm is initializing, delay 200ms...
[start] ycm started: 3958
[buildRequest] document, /home/agauniyal/projects/rang/include/rang.hpp; position: null; event: BufferVisit
[_request] {"filepath":"/home/agauniyal/projects/rang/include/rang.hpp","working_dir":"/home/agauniyal/projects/rang","file_data":{"/home/agauniyal/projects/rang/include/rang.hpp":{"contents":"#ifndef RANG_DOT_HPP\n#define RANG_DOT_HPP\n\n#if defined(__unix__) || defined(__unix) || defined(__linux__)\n#define OS_LINUX\n#elif defined(WIN32) || defined(_WIN32) || defined(_WIN64)\n#define OS_WIN\n#elif defined(__APPLE__) || defined(__MACH__)\n#define OS_MAC\n#else\n#error Unknown Platform\n#endif\n\n#if defined(OS_LINUX) || defined(OS_MAC)\n#include <unistd.h>\n#include <cstring>\n#elif defined(OS_WIN)\n#include <windows.h>\n#include <io.h>\n#include <VersionHelpers.h>\n#endif\n\n#include <algorithm>\n#include <cstdlib>\n#include <ios>\n#include <iostream>\n#include <iterator>\n#include <type_traits>\n#include <atomic>\n\nnamespace rang {\n\nenum class style {\n\treset     = 0,\n\tbold      = 1,\n\tdim       = 2,\n\titalic    = 3,\n\tunderline = 4,\n\tblink     = 5,\n\trblink    = 6,\n\treversed  = 7,\n\tconceal   = 8,\n\tcrossed   = 9\n};\n\nenum class fg {\n\tblack   = 30,\n\tred     = 31,\n\tgreen   = 32,\n\tyellow  = 33,\n\tblue    = 34,\n\tmagenta = 35,\n\tcyan    = 36,\n\tgray    = 37,\n\treset   = 39\n};\n\nenum class bg {\n\tblack   = 40,\n\tred     = 41,\n\tgreen   = 42,\n\tyellow  = 43,\n\tblue    = 44,\n\tmagenta = 45,\n\tcyan    = 46,\n\tgray    = 47,\n\treset   = 49\n};\n\nenum class fgB {\n\tblack   = 90,\n\tred     = 91,\n\tgreen   = 92,\n\tyellow  = 93,\n\tblue    = 94,\n\tmagenta = 95,\n\tcyan    = 96,\n\tgray    = 97\n};\n\nenum class bgB {\n\tblack   = 100,\n\tred     = 101,\n\tgreen   = 102,\n\tyellow  = 103,\n\tblue    = 104,\n\tmagenta = 105,\n\tcyan    = 106,\n\tgray    = 107\n};\n\nenum class control { offColor = 0, autoColor = 1, forceColor = 2 };\n\n\nnamespace rang_implementation {\n\n\n\tinline std::streambuf const *&RANG_coutbuf()\n\t{\n\t\tstatic std::streambuf const *pOutbuff = std::cout.rdbuf();\n\t\treturn pOutbuff;\n\t}\n\n\tinline std::streambuf const *&RANG_cerrbuf()\n\t{\n\t\tstatic std::streambuf const *pErrbuff = std::cerr.rdbuf();\n\t\treturn pErrbuff;\n\t}\n\n\tinline std::streambuf const *&RANG_clogbuf()\n\t{\n\t\tstatic std::streambuf const *pLogbuff = std::clog.rdbuf();\n\t\treturn pLogbuff;\n\t}\n\n\n\tinline std::atomic<int> &controlValue()\n\t{\n\t\tstatic std::atomic<int> value(1);\n\t\treturn value;\n\t}\n\n\n\tinline bool supportsColor()\n\t{\n#if defined(OS_LINUX) || defined(OS_MAC)\n\t\tstatic constexpr const char *Terms[] = {\n\t\t\t\"ansi\", \"color\", \"console\", \"cygwin\", \"gnome\", \"konsole\", \"kterm\",\n\t\t\t\"linux\", \"msys\", \"putty\", \"rxvt\", \"screen\", \"vt100\", \"xterm\"\n\t\t};\n\n\t\tstatic const char *env_p = std::getenv(\"TERM\");\n\n\t\tstatic const bool result = (env_p == nullptr)\n\t\t  ? false\n\t\t  : std::any_of(\n\t\t      std::begin(Terms), std::end(Terms), [](const char *term) {\n\t\t\t      return std::strstr(env_p, term) != nullptr;\n\t\t\t  });\n\n#elif defined(OS_WIN)\n\t\tstatic constexpr bool result = true;\n#endif\n\t\treturn result;\n\t}\n\n\n\tinline bool isTerminal(const std::streambuf *osbuf)\n\t{\n\t\tif (osbuf == RANG_coutbuf()) {\n#if defined(OS_LINUX) || defined(OS_MAC)\n\t\t\treturn isatty(fileno(stdout)) ? true : false;\n#elif defined(OS_WIN)\n\t\t\treturn _isatty(_fileno(stdout)) ? true : false;\n#endif\n\t\t}\n\n\t\tif (osbuf == RANG_cerrbuf() || osbuf == RANG_clogbuf()) {\n#if defined(OS_LINUX) || defined(OS_MAC)\n\t\t\treturn isatty(fileno(stderr)) ? true : false;\n#elif defined(OS_WIN)\n\t\t\treturn _isatty(_fileno(stderr)) ? true : false;\n#endif\n\t\t}\n\t\treturn false;\n\t}\n\n\n\ttemplate <typename T>\n\tusing enableStd =\n\t  typename std::enable_if<std::is_same<T, rang::style>::value\n\t      || std::is_same<T, rang::fg>::value\n\t      || std::is_same<T, rang::bg>::value\n\t      || std::is_same<T, rang::fgB>::value\n\t      || std::is_same<T, rang::bgB>::value,\n\t    std::ostream &>::type;\n\n\n#ifdef OS_WIN\n\tHANDLE getVersionDependentHandle()\n\t{\n\t\tif (IsWindowsVersionOrGreater(10, 0, 0)) return nullptr;\n\t\treturn GetStdHandle(STD_OUTPUT_HANDLE);\n\t}\n\n\tinline HANDLE getConsoleHandle()\n\t{\n\t\tstatic HANDLE h = getVersionDependentHandle();\n\t\treturn h;\n\t}\n\n\tinline WORD reverseRGB(WORD rgb)\n\t{\n\t\tstatic const WORD rev[8] = { 0, 4, 2, 6, 1, 5, 3, 7 };\n\t\treturn rev[rgb];\n\t}\n\n\tinline void setWinAttribute(rang::bg col, WORD &state)\n\t{\n\t\tstate &= 0xFF0F;\n\t\tstate |= reverseRGB(static_cast<WORD>(col) - 40) << 4;\n\t}\n\n\tinline void setWinAttribute(rang::fg col, WORD &state)\n\t{\n\t\tstate &= 0xFFF0;\n\t\tstate |= reverseRGB(static_cast<WORD>(col) - 30);\n\t}\n\n\tinline void setWinAttribute(rang::bgB col, WORD &state)\n\t{\n\t\tstate &= 0xFF0F;\n\t\tstate |= (0x8 | reverseRGB(static_cast<WORD>(col) - 100)) << 4;\n\t}\n\n\tinline void setWinAttribute(rang::fgB col, WORD &state)\n\t{\n\t\tstate &= 0xFFF0;\n\t\tstate |= (0x8 | reverseRGB(static_cast<WORD>(col) - 90));\n\t}\n\n\tinline void setWinAttribute(rang::style style, WORD &state)\n\t{\n\t\tif (style == rang::style::reset) {\n\t\t\tstate = (FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED);\n\t\t}\n\t}\n\n\tinline WORD &current_state()\n\t{\n\t\tstatic WORD state\n\t\t  = (FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED);\n\t\treturn state;\n\t}\n\n\n\ttemplate <typename T>\n\tinline enableStd<T> setColor(std::ostream &os, T const value)\n\t{\n\t\tHANDLE h = getConsoleHandle();\n\t\tif (h && isTerminal(os.rdbuf())) {\n\t\t\tsetWinAttribute(value, current_state());\n\t\t\tSetConsoleTextAttribute(h, current_state());\n\t\t\treturn os;\n\t\t}\n\t\treturn os << \"\\033[\" << static_cast<int>(value) << \"m\";\n\t}\n#else\n\ttemplate <typename T>\n\tinline enableStd<T> setColor(std::ostream &os, T const value)\n\t{\n\t\treturn os << \"\\033[\" << static_cast<int>(value) << \"m\";\n\t}\n#endif\n\n\ttemplate <typename T>\n\tusing enableControl =\n\t  typename std::enable_if<std::is_same<T, rang::control>::value,\n\t    std::ostream &>::type;\n}\n\n\nvoid init()\n{\n\trang_implementation::RANG_coutbuf();\n\trang_implementation::RANG_cerrbuf();\n\trang_implementation::RANG_clogbuf();\n}\n\n\ntemplate <typename T>\ninline rang_implementation::enableStd<T> operator<<(\n  std::ostream &os, T const value)\n{\n\tconst int option = rang_implementation::controlValue();\n\tswitch (option) {\n\t\tcase 0: return os;\n\t\tcase 1:\n\t\t\treturn rang_implementation::supportsColor()\n\t\t\t    && rang_implementation::isTerminal(os.rdbuf())\n\t\t\t  ? rang_implementation::setColor(os, value)\n\t\t\t  : os;\n\t\tcase 2: return rang_implementation::setColor(os, value);\n\t\tdefault: return os;\n\t}\n}\n\n\ntemplate <typename T>\ninline rang_implementation::enableControl<T> operator<<(\n  std::ostream &os, T const value)\n{\n\tif (value == rang::control::offColor) {\n\t\trang_implementation::controlValue() = 0;\n\t} else if (value == rang::control::autoColor) {\n\t\trang_implementation::controlValue() = 1;\n\t} else if (value == rang::control::forceColor) {\n\t\trang_implementation::controlValue() = 2;\n\t}\n\treturn os;\n}\n}\n\n#undef OS_LINUX\n#undef OS_WIN\n#undef OS_MAC\n\n#endif /* ifndef RANG_DOT_HPP */\n","filetypes":["cpp"]}},"line_num":1,"column_num":1,"event_name":"BufferVisit"}
[buildRequest] document, /home/agauniyal/projects/rang/include/rang.hpp; position: [object Object]; event: null
[_request] {"filepath":"/home/agauniyal/projects/rang/include/rang.hpp","working_dir":"/home/agauniyal/projects/rang","file_data":{"/home/agauniyal/projects/rang/include/rang.hpp":{"contents":"#ifndef RANG_DOT_HPP\n#define RANG_DOT_HPP\n\n#if defined(__unix__) || defined(__unix) || defined(__linux__)\n#define OS_LINUX\n#elif defined(WIN32) || defined(_WIN32) || defined(_WIN64)\n#define OS_WIN\n#elif defined(__APPLE__) || defined(__MACH__)\n#define OS_MAC\n#else\n#error Unknown Platform\n#endif\n\n#if defined(OS_LINUX) || defined(OS_MAC)\n#include <unistd.h>\n#include <cstring>\n#elif defined(OS_WIN)\n#include <windows.h>\n#include <io.h>\n#include <VersionHelpers.h>\n#endif\n\n#include <algorithm>\n#include <cstdlib>\n#include <ios>\n#include <iostream>\n#include <iterator>\n#include <type_traits>\n#include <atomic>\n\nnamespace rang {\n\nenum class style {\n\treset     = 0,\n\tbold      = 1,\n\tdim       = 2,\n\titalic    = 3,\n\tunderline = 4,\n\tblink     = 5,\n\trblink    = 6,\n\treversed  = 7,\n\tconceal   = 8,\n\tcrossed   = 9\n};\n\nenum class fg {\n\tblack   = 30,\n\tred     = 31,\n\tgreen   = 32,\n\tyellow  = 33,\n\tblue    = 34,\n\tmagenta = 35,\n\tcyan    = 36,\n\tgray    = 37,\n\treset   = 39\n};\n\nenum class bg {\n\tblack   = 40,\n\tred     = 41,\n\tgreen   = 42,\n\tyellow  = 43,\n\tblue    = 44,\n\tmagenta = 45,\n\tcyan    = 46,\n\tgray    = 47,\n\treset   = 49\n};\n\nenum class fgB {\n\tblack   = 90,\n\tred     = 91,\n\tgreen   = 92,\n\tyellow  = 93,\n\tblue    = 94,\n\tmagenta = 95,\n\tcyan    = 96,\n\tgray    = 97\n};\n\nenum class bgB {\n\tblack   = 100,\n\tred     = 101,\n\tgreen   = 102,\n\tyellow  = 103,\n\tblue    = 104,\n\tmagenta = 105,\n\tcyan    = 106,\n\tgray    = 107\n};\n\nenum class control { offColor = 0, autoColor = 1, forceColor = 2 };\n\n\nnamespace rang_implementation {\n\n\n\tinline std::streambuf const *&RANG_coutbuf()\n\t{\n\t\tstatic std::streambuf const *pOutbuff = std::cout.rdbuf();\n\t\treturn pOutbuff;\n\t}\n\n\tinline std::streambuf const *&RANG_cerrbuf()\n\t{\n\t\tstatic std::streambuf const *pErrbuff = std::cerr.rdbuf();\n\t\treturn pErrbuff;\n\t}\n\n\tinline std::streambuf const *&RANG_clogbuf()\n\t{\n\t\tstatic std::streambuf const *pLogbuff = std::clog.rdbuf();\n\t\treturn pLogbuff;\n\t}\n\n\n\tinline std::atomic<int> &controlValue()\n\t{\n\t\tstatic std::atomic<int> value(1);\n\t\treturn value;\n\t}\n\n\n\tinline bool supportsColor()\n\t{\n#if defined(OS_LINUX) || defined(OS_MAC)\n\t\tstatic constexpr const char *Terms[] = {\n\t\t\t\"ansi\", \"color\", \"console\", \"cygwin\", \"gnome\", \"konsole\", \"kterm\",\n\t\t\t\"linux\", \"msys\", \"putty\", \"rxvt\", \"screen\", \"vt100\", \"xterm\"\n\t\t};\n\n\t\tstatic const char *env_p = std::getenv(\"TERM\");\n\n\t\tstatic const bool result = (env_p == nullptr)\n\t\t  ? false\n\t\t  : std::any_of(\n\t\t      std::begin(Terms), std::end(Terms), [](const char *term) {\n\t\t\t      return std::strstr(env_p, term) != nullptr;\n\t\t\t  });\n\n#elif defined(OS_WIN)\n\t\tstatic constexpr bool result = true;\n#endif\n\t\treturn result;\n\t}\n\n\n\tinline bool isTerminal(const std::streambuf *osbuf)\n\t{\n\t\tif (osbuf == RANG_coutbuf()) {\n#if defined(OS_LINUX) || defined(OS_MAC)\n\t\t\treturn isatty(fileno(stdout)) ? true : false;\n#elif defined(OS_WIN)\n\t\t\treturn _isatty(_fileno(stdout)) ? true : false;\n#endif\n\t\t}\n\n\t\tif (osbuf == RANG_cerrbuf() || osbuf == RANG_clogbuf()) {\n#if defined(OS_LINUX) || defined(OS_MAC)\n\t\t\treturn isatty(fileno(stderr)) ? true : false;\n#elif defined(OS_WIN)\n\t\t\treturn _isatty(_fileno(stderr)) ? true : false;\n#endif\n\t\t}\n\t\treturn false;\n\t}\n\n\n\ttemplate <typename T>\n\tusing enableStd =\n\t  typename std::enable_if<std::is_same<T, rang::style>::value\n\t      || std::is_same<T, rang::fg>::value\n\t      || std::is_same<T, rang::bg>::value\n\t      || std::is_same<T, rang::fgB>::value\n\t      || std::is_same<T, rang::bgB>::value,\n\t    std::ostream &>::type;\n\n\n#ifdef OS_WIN\n\tHANDLE getVersionDependentHandle()\n\t{\n\t\tif (IsWindowsVersionOrGreater(10, 0, 0)) return nullptr;\n\t\treturn GetStdHandle(STD_OUTPUT_HANDLE);\n\t}\n\n\tinline HANDLE getConsoleHandle()\n\t{\n\t\tstatic HANDLE h = getVersionDependentHandle();\n\t\treturn h;\n\t}\n\n\tinline WORD reverseRGB(WORD rgb)\n\t{\n\t\tstatic const WORD rev[8] = { 0, 4, 2, 6, 1, 5, 3, 7 };\n\t\treturn rev[rgb];\n\t}\n\n\tinline void setWinAttribute(rang::bg col, WORD &state)\n\t{\n\t\tstate &= 0xFF0F;\n\t\tstate |= reverseRGB(static_cast<WORD>(col) - 40) << 4;\n\t}\n\n\tinline void setWinAttribute(rang::fg col, WORD &state)\n\t{\n\t\tstate &= 0xFFF0;\n\t\tstate |= reverseRGB(static_cast<WORD>(col) - 30);\n\t}\n\n\tinline void setWinAttribute(rang::bgB col, WORD &state)\n\t{\n\t\tstate &= 0xFF0F;\n\t\tstate |= (0x8 | reverseRGB(static_cast<WORD>(col) - 100)) << 4;\n\t}\n\n\tinline void setWinAttribute(rang::fgB col, WORD &state)\n\t{\n\t\tstate &= 0xFFF0;\n\t\tstate |= (0x8 | reverseRGB(static_cast<WORD>(col) - 90));\n\t}\n\n\tinline void setWinAttribute(rang::style style, WORD &state)\n\t{\n\t\tif (style == rang::style::reset) {\n\t\t\tstate = (FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED);\n\t\t}\n\t}\n\n\tinline WORD &current_state()\n\t{\n\t\tstatic WORD state\n\t\t  = (FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED);\n\t\treturn state;\n\t}\n\n\n\ttemplate <typename T>\n\tinline enableStd<T> setColor(std::ostream &os, T const value)\n\t{\n\t\tHANDLE h = getConsoleHandle();\n\t\tif (h && isTerminal(os.rdbuf())) {\n\t\t\tsetWinAttribute(value, current_state());\n\t\t\tSetConsoleTextAttribute(h, current_state());\n\t\t\treturn os;\n\t\t}\n\t\treturn os << \"\\033[\" << static_cast<int>(value) << \"m\";\n\t}\n#else\n\ttemplate <typename T>\n\tinline enableStd<T> setColor(std::ostream &os, T const value)\n\t{\n\t\treturn os << \"\\033[\" << static_cast<int>(value) << \"m\";\n\t}\n#endif\n\n\ttemplate <typename T>\n\tusing enableControl =\n\t  typename std::enable_if<std::is_same<T, rang::control>::value,\n\t    std::ostream &>::type;\n}\n\n\nvoid init()\n{\n\trang_implementation::RANG_coutbuf();\n\trang_implementation::RANG_cerrbuf();\n\trang_implementation::RANG_clogbuf();\n}\n\n\ntemplate <typename T>\ninline rang_implementation::enableStd<T> operator<<(\n  std::ostream &os, T const value)\n{\n\tconst int option = rang_implementation::controlValue();\n\tswitch (option) {\n\t\tcase 0: return os;\n\t\tcase 1:\n\t\t\treturn rang_implementation::supportsColor()\n\t\t\t    && rang_implementation::isTerminal(os.rdbuf())\n\t\t\t  ? rang_implementation::setColor(os, value)\n\t\t\t  : os;\n\t\tcase 2: return rang_implementation::setColor(os, value);\n\t\tdefault: return os;\n\t}\n}\n\n\ntemplate <typename T>\ninline rang_implementation::enableControl<T> operator<<(\n  std::ostream &os, T const value)\n{\n\tif (value == rang::control::offColor) {\n\t\trang_implementation::controlValue() = 0;\n\t} else if (value == rang::control::autoColor) {\n\t\trang_implementation::controlValue() = 1;\n\t} else if (value == rang::control::forceColor) {\n\t\trang_implementation::controlValue() = 2;\n\t}\n\treturn os;\n}\n}\n\n#undef OS_LINUX\n#undef OS_WIN\n#undef OS_MAC\n\n#endif /* ifndef RANG_DOT_HPP */\n","filetypes":["cpp"]}},"line_num":9,"column_num":9,"command_arguments":["FixIt"],"completer_target":"filetype_default"}
[buildRequest] document, /home/agauniyal/projects/rang/include/rang.hpp; position: [object Object]; event: null
[_request] {"filepath":"/home/agauniyal/projects/rang/include/rang.hpp","working_dir":"/home/agauniyal/projects/rang","file_data":{"/home/agauniyal/projects/rang/include/rang.hpp":{"contents":"#ifndef RANG_DOT_HPP\n#define RANG_DOT_HPP\n\n#if defined(__unix__) || defined(__unix) || defined(__linux__)\n#define OS_LINUX\n#elif defined(WIN32) || defined(_WIN32) || defined(_WIN64)\n#define OS_WIN\n#elif defined(__APPLE__) || defined(__MACH__)\n#define OS_MAC\n#else\n#error Unknown Platform\n#endif\n\n#if defined(OS_LINUX) || defined(OS_MAC)\n#include <unistd.h>\n#include <cstring>\n#elif defined(OS_WIN)\n#include <windows.h>\n#include <io.h>\n#include <VersionHelpers.h>\n#endif\n\n#include <algorithm>\n#include <cstdlib>\n#include <ios>\n#include <iostream>\n#include <iterator>\n#include <type_traits>\n#include <atomic>\n\nnamespace rang {\n\nenum class style {\n\treset     = 0,\n\tbold      = 1,\n\tdim       = 2,\n\titalic    = 3,\n\tunderline = 4,\n\tblink     = 5,\n\trblink    = 6,\n\treversed  = 7,\n\tconceal   = 8,\n\tcrossed   = 9\n};\n\nenum class fg {\n\tblack   = 30,\n\tred     = 31,\n\tgreen   = 32,\n\tyellow  = 33,\n\tblue    = 34,\n\tmagenta = 35,\n\tcyan    = 36,\n\tgray    = 37,\n\treset   = 39\n};\n\nenum class bg {\n\tblack   = 40,\n\tred     = 41,\n\tgreen   = 42,\n\tyellow  = 43,\n\tblue    = 44,\n\tmagenta = 45,\n\tcyan    = 46,\n\tgray    = 47,\n\treset   = 49\n};\n\nenum class fgB {\n\tblack   = 90,\n\tred     = 91,\n\tgreen   = 92,\n\tyellow  = 93,\n\tblue    = 94,\n\tmagenta = 95,\n\tcyan    = 96,\n\tgray    = 97\n};\n\nenum class bgB {\n\tblack   = 100,\n\tred     = 101,\n\tgreen   = 102,\n\tyellow  = 103,\n\tblue    = 104,\n\tmagenta = 105,\n\tcyan    = 106,\n\tgray    = 107\n};\n\nenum class control { offColor = 0, autoColor = 1, forceColor = 2 };\n\n\nnamespace rang_implementation {\n\n\n\tinline std::streambuf const *&RANG_coutbuf()\n\t{\n\t\tstatic std::streambuf const *pOutbuff = std::cout.rdbuf();\n\t\treturn pOutbuff;\n\t}\n\n\tinline std::streambuf const *&RANG_cerrbuf()\n\t{\n\t\tstatic std::streambuf const *pErrbuff = std::cerr.rdbuf();\n\t\treturn pErrbuff;\n\t}\n\n\tinline std::streambuf const *&RANG_clogbuf()\n\t{\n\t\tstatic std::streambuf const *pLogbuff = std::clog.rdbuf();\n\t\treturn pLogbuff;\n\t}\n\n\n\tinline std::atomic<int> &controlValue()\n\t{\n\t\tstatic std::atomic<int> value(1);\n\t\treturn value;\n\t}\n\n\n\tinline bool supportsColor()\n\t{\n#if defined(OS_LINUX) || defined(OS_MAC)\n\t\tstatic constexpr const char *Terms[] = {\n\t\t\t\"ansi\", \"color\", \"console\", \"cygwin\", \"gnome\", \"konsole\", \"kterm\",\n\t\t\t\"linux\", \"msys\", \"putty\", \"rxvt\", \"screen\", \"vt100\", \"xterm\"\n\t\t};\n\n\t\tstatic const char *env_p = std::getenv(\"TERM\");\n\n\t\tstatic const bool result = (env_p == nullptr)\n\t\t  ? false\n\t\t  : std::any_of(\n\t\t      std::begin(Terms), std::end(Terms), [](const char *term) {\n\t\t\t      return std::strstr(env_p, term) != nullptr;\n\t\t\t  });\n\n#elif defined(OS_WIN)\n\t\tstatic constexpr bool result = true;\n#endif\n\t\treturn result;\n\t}\n\n\n\tinline bool isTerminal(const std::streambuf *osbuf)\n\t{\n\t\tif (osbuf == RANG_coutbuf()) {\n#if defined(OS_LINUX) || defined(OS_MAC)\n\t\t\treturn isatty(fileno(stdout)) ? true : false;\n#elif defined(OS_WIN)\n\t\t\treturn _isatty(_fileno(stdout)) ? true : false;\n#endif\n\t\t}\n\n\t\tif (osbuf == RANG_cerrbuf() || osbuf == RANG_clogbuf()) {\n#if defined(OS_LINUX) || defined(OS_MAC)\n\t\t\treturn isatty(fileno(stderr)) ? true : false;\n#elif defined(OS_WIN)\n\t\t\treturn _isatty(_fileno(stderr)) ? true : false;\n#endif\n\t\t}\n\t\treturn false;\n\t}\n\n\n\ttemplate <typename T>\n\tusing enableStd =\n\t  typename std::enable_if<std::is_same<T, rang::style>::value\n\t      || std::is_same<T, rang::fg>::value\n\t      || std::is_same<T, rang::bg>::value\n\t      || std::is_same<T, rang::fgB>::value\n\t      || std::is_same<T, rang::bgB>::value,\n\t    std::ostream &>::type;\n\n\n#ifdef OS_WIN\n\tHANDLE getVersionDependentHandle()\n\t{\n\t\tif (IsWindowsVersionOrGreater(10, 0, 0)) return nullptr;\n\t\treturn GetStdHandle(STD_OUTPUT_HANDLE);\n\t}\n\n\tinline HANDLE getConsoleHandle()\n\t{\n\t\tstatic HANDLE h = getVersionDependentHandle();\n\t\treturn h;\n\t}\n\n\tinline WORD reverseRGB(WORD rgb)\n\t{\n\t\tstatic const WORD rev[8] = { 0, 4, 2, 6, 1, 5, 3, 7 };\n\t\treturn rev[rgb];\n\t}\n\n\tinline void setWinAttribute(rang::bg col, WORD &state)\n\t{\n\t\tstate &= 0xFF0F;\n\t\tstate |= reverseRGB(static_cast<WORD>(col) - 40) << 4;\n\t}\n\n\tinline void setWinAttribute(rang::fg col, WORD &state)\n\t{\n\t\tstate &= 0xFFF0;\n\t\tstate |= reverseRGB(static_cast<WORD>(col) - 30);\n\t}\n\n\tinline void setWinAttribute(rang::bgB col, WORD &state)\n\t{\n\t\tstate &= 0xFF0F;\n\t\tstate |= (0x8 | reverseRGB(static_cast<WORD>(col) - 100)) << 4;\n\t}\n\n\tinline void setWinAttribute(rang::fgB col, WORD &state)\n\t{\n\t\tstate &= 0xFFF0;\n\t\tstate |= (0x8 | reverseRGB(static_cast<WORD>(col) - 90));\n\t}\n\n\tinline void setWinAttribute(rang::style style, WORD &state)\n\t{\n\t\tif (style == rang::style::reset) {\n\t\t\tstate = (FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED);\n\t\t}\n\t}\n\n\tinline WORD &current_state()\n\t{\n\t\tstatic WORD state\n\t\t  = (FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED);\n\t\treturn state;\n\t}\n\n\n\ttemplate <typename T>\n\tinline enableStd<T> setColor(std::ostream &os, T const value)\n\t{\n\t\tHANDLE h = getConsoleHandle();\n\t\tif (h && isTerminal(os.rdbuf())) {\n\t\t\tsetWinAttribute(value, current_state());\n\t\t\tSetConsoleTextAttribute(h, current_state());\n\t\t\treturn os;\n\t\t}\n\t\treturn os << \"\\033[\" << static_cast<int>(value) << \"m\";\n\t}\n#else\n\ttemplate <typename T>\n\tinline enableStd<T> setColor(std::ostream &os, T const value)\n\t{\n\t\treturn os << \"\\033[\" << static_cast<int>(value) << \"m\";\n\t}\n#endif\n\n\ttemplate <typename T>\n\tusing enableControl =\n\t  typename std::enable_if<std::is_same<T, rang::control>::value,\n\t    std::ostream &>::type;\n}\n\n\nvoid init()\n{\n\trang_implementation::RANG_coutbuf();\n\trang_implementation::RANG_cerrbuf();\n\trang_implementation::RANG_clogbuf();\n}\n\n\ntemplate <typename T>\ninline rang_implementation::enableStd<T> operator<<(\n  std::ostream &os, T const value)\n{\n\tconst int option = rang_implementation::controlValue();\n\tswitch (option) {\n\t\tcase 0: return os;\n\t\tcase 1:\n\t\t\treturn rang_implementation::supportsColor()\n\t\t\t    && rang_implementation::isTerminal(os.rdbuf())\n\t\t\t  ? rang_implementation::setColor(os, value)\n\t\t\t  : os;\n\t\tcase 2: return rang_implementation::setColor(os, value);\n\t\tdefault: return os;\n\t}\n}\n\n\ntemplate <typename T>\ninline rang_implementation::enableControl<T> operator<<(\n  std::ostream &os, T const value)\n{\n\tif (value == rang::control::offColor) {\n\t\trang_implementation::controlValue() = 0;\n\t} else if (value == rang::control::autoColor) {\n\t\trang_implementation::controlValue() = 1;\n\t} else if (value == rang::control::forceColor) {\n\t\trang_implementation::controlValue() = 2;\n\t}\n\treturn os;\n}\n}\n\n#undef OS_LINUX\n#undef OS_WIN\n#undef OS_MAC\n\n#endif /* ifndef RANG_DOT_HPP */\n","filetypes":["cpp"]}},"line_num":9,"column_num":9,"command_arguments":["FixIt"],"completer_target":"filetype_default"}
[buildRequest] document, /home/agauniyal/projects/rang/include/rang.hpp; position: [object Object]; event: null
[_request] {"filepath":"/home/agauniyal/projects/rang/include/rang.hpp","working_dir":"/home/agauniyal/projects/rang","file_data":{"/home/agauniyal/projects/rang/include/rang.hpp":{"contents":"#ifndef RANG_DOT_HPP\n#define RANG_DOT_HPP\n\n#if defined(__unix__) || defined(__unix) || defined(__linux__)\n#define OS_LINUX\n#elif defined(WIN32) || defined(_WIN32) || defined(_WIN64)\n#define OS_WIN\n#elif defined(__APPLE__) || defined(__MACH__)\n#define OS_MAC\n#else\n#error Unknown Platform\n#endif\n\n#if defined(OS_LINUX) || defined(OS_MAC)\n#include <unistd.h>\n#include <cstring>\n#elif defined(OS_WIN)\n#include <windows.h>\n#include <io.h>\n#include <VersionHelpers.h>\n#endif\n\n#include <algorithm>\n#include <cstdlib>\n#include <ios>\n#include <iostream>\n#include <iterator>\n#include <type_traits>\n#include <atomic>\n\nnamespace rang {\n\nenum class style {\n\treset     = 0,\n\tbold      = 1,\n\tdim       = 2,\n\titalic    = 3,\n\tunderline = 4,\n\tblink     = 5,\n\trblink    = 6,\n\treversed  = 7,\n\tconceal   = 8,\n\tcrossed   = 9\n};\n\nenum class fg {\n\tblack   = 30,\n\tred     = 31,\n\tgreen   = 32,\n\tyellow  = 33,\n\tblue    = 34,\n\tmagenta = 35,\n\tcyan    = 36,\n\tgray    = 37,\n\treset   = 39\n};\n\nenum class bg {\n\tblack   = 40,\n\tred     = 41,\n\tgreen   = 42,\n\tyellow  = 43,\n\tblue    = 44,\n\tmagenta = 45,\n\tcyan    = 46,\n\tgray    = 47,\n\treset   = 49\n};\n\nenum class fgB {\n\tblack   = 90,\n\tred     = 91,\n\tgreen   = 92,\n\tyellow  = 93,\n\tblue    = 94,\n\tmagenta = 95,\n\tcyan    = 96,\n\tgray    = 97\n};\n\nenum class bgB {\n\tblack   = 100,\n\tred     = 101,\n\tgreen   = 102,\n\tyellow  = 103,\n\tblue    = 104,\n\tmagenta = 105,\n\tcyan    = 106,\n\tgray    = 107\n};\n\nenum class control { offColor = 0, autoColor = 1, forceColor = 2 };\n\n\nnamespace rang_implementation {\n\n\n\tinline std::streambuf const *&RANG_coutbuf()\n\t{\n\t\tstatic std::streambuf const *pOutbuff = std::cout.rdbuf();\n\t\treturn pOutbuff;\n\t}\n\n\tinline std::streambuf const *&RANG_cerrbuf()\n\t{\n\t\tstatic std::streambuf const *pErrbuff = std::cerr.rdbuf();\n\t\treturn pErrbuff;\n\t}\n\n\tinline std::streambuf const *&RANG_clogbuf()\n\t{\n\t\tstatic std::streambuf const *pLogbuff = std::clog.rdbuf();\n\t\treturn pLogbuff;\n\t}\n\n\n\tinline std::atomic<int> &controlValue()\n\t{\n\t\tstatic std::atomic<int> value(1);\n\t\treturn value;\n\t}\n\n\n\tinline bool supportsColor()\n\t{\n#if defined(OS_LINUX) || defined(OS_MAC)\n\t\tstatic constexpr const char *Terms[] = {\n\t\t\t\"ansi\", \"color\", \"console\", \"cygwin\", \"gnome\", \"konsole\", \"kterm\",\n\t\t\t\"linux\", \"msys\", \"putty\", \"rxvt\", \"screen\", \"vt100\", \"xterm\"\n\t\t};\n\n\t\tstatic const char *env_p = std::getenv(\"TERM\");\n\n\t\tstatic const bool result = (env_p == nullptr)\n\t\t  ? false\n\t\t  : std::any_of(\n\t\t      std::begin(Terms), std::end(Terms), [](const char *term) {\n\t\t\t      return std::strstr(env_p, term) != nullptr;\n\t\t\t  });\n\n#elif defined(OS_WIN)\n\t\tstatic constexpr bool result = true;\n#endif\n\t\treturn result;\n\t}\n\n\n\tinline bool isTerminal(const std::streambuf *osbuf)\n\t{\n\t\tif (osbuf == RANG_coutbuf()) {\n#if defined(OS_LINUX) || defined(OS_MAC)\n\t\t\treturn isatty(fileno(stdout)) ? true : false;\n#elif defined(OS_WIN)\n\t\t\treturn _isatty(_fileno(stdout)) ? true : false;\n#endif\n\t\t}\n\n\t\tif (osbuf == RANG_cerrbuf() || osbuf == RANG_clogbuf()) {\n#if defined(OS_LINUX) || defined(OS_MAC)\n\t\t\treturn isatty(fileno(stderr)) ? true : false;\n#elif defined(OS_WIN)\n\t\t\treturn _isatty(_fileno(stderr)) ? true : false;\n#endif\n\t\t}\n\t\treturn false;\n\t}\n\n\n\ttemplate <typename T>\n\tusing enableStd =\n\t  typename std::enable_if<std::is_same<T, rang::style>::value\n\t      || std::is_same<T, rang::fg>::value\n\t      || std::is_same<T, rang::bg>::value\n\t      || std::is_same<T, rang::fgB>::value\n\t      || std::is_same<T, rang::bgB>::value,\n\t    std::ostream &>::type;\n\n\n#ifdef OS_WIN\n\tHANDLE getVersionDependentHandle()\n\t{\n\t\tif (IsWindowsVersionOrGreater(10, 0, 0)) return nullptr;\n\t\treturn GetStdHandle(STD_OUTPUT_HANDLE);\n\t}\n\n\tinline HANDLE getConsoleHandle()\n\t{\n\t\tstatic HANDLE h = getVersionDependentHandle();\n\t\treturn h;\n\t}\n\n\tinline WORD reverseRGB(WORD rgb)\n\t{\n\t\tstatic const WORD rev[8] = { 0, 4, 2, 6, 1, 5, 3, 7 };\n\t\treturn rev[rgb];\n\t}\n\n\tinline void setWinAttribute(rang::bg col, WORD &state)\n\t{\n\t\tstate &= 0xFF0F;\n\t\tstate |= reverseRGB(static_cast<WORD>(col) - 40) << 4;\n\t}\n\n\tinline void setWinAttribute(rang::fg col, WORD &state)\n\t{\n\t\tstate &= 0xFFF0;\n\t\tstate |= reverseRGB(static_cast<WORD>(col) - 30);\n\t}\n\n\tinline void setWinAttribute(rang::bgB col, WORD &state)\n\t{\n\t\tstate &= 0xFF0F;\n\t\tstate |= (0x8 | reverseRGB(static_cast<WORD>(col) - 100)) << 4;\n\t}\n\n\tinline void setWinAttribute(rang::fgB col, WORD &state)\n\t{\n\t\tstate &= 0xFFF0;\n\t\tstate |= (0x8 | reverseRGB(static_cast<WORD>(col) - 90));\n\t}\n\n\tinline void setWinAttribute(rang::style style, WORD &state)\n\t{\n\t\tif (style == rang::style::reset) {\n\t\t\tstate = (FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED);\n\t\t}\n\t}\n\n\tinline WORD &current_state()\n\t{\n\t\tstatic WORD state\n\t\t  = (FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED);\n\t\treturn state;\n\t}\n\n\n\ttemplate <typename T>\n\tinline enableStd<T> setColor(std::ostream &os, T const value)\n\t{\n\t\tHANDLE h = getConsoleHandle();\n\t\tif (h && isTerminal(os.rdbuf())) {\n\t\t\tsetWinAttribute(value, current_state());\n\t\t\tSetConsoleTextAttribute(h, current_state());\n\t\t\treturn os;\n\t\t}\n\t\treturn os << \"\\033[\" << static_cast<int>(value) << \"m\";\n\t}\n#else\n\ttemplate <typename T>\n\tinline enableStd<T> setColor(std::ostream &os, T const value)\n\t{\n\t\treturn os << \"\\033[\" << static_cast<int>(value) << \"m\";\n\t}\n#endif\n\n\ttemplate <typename T>\n\tusing enableControl =\n\t  typename std::enable_if<std::is_same<T, rang::control>::value,\n\t    std::ostream &>::type;\n}\n\n\nvoid init()\n{\n\trang_implementation::RANG_coutbuf();\n\trang_implementation::RANG_cerrbuf();\n\trang_implementation::RANG_clogbuf();\n}\n\n\ntemplate <typename T>\ninline rang_implementation::enableStd<T> operator<<(\n  std::ostream &os, T const value)\n{\n\tconst int option = rang_implementation::controlValue();\n\tswitch (option) {\n\t\tcase 0: return os;\n\t\tcase 1:\n\t\t\treturn rang_implementation::supportsColor()\n\t\t\t    && rang_implementation::isTerminal(os.rdbuf())\n\t\t\t  ? rang_implementation::setColor(os, value)\n\t\t\t  : os;\n\t\tcase 2: return rang_implementation::setColor(os, value);\n\t\tdefault: return os;\n\t}\n}\n\n\ntemplate <typename T>\ninline rang_implementation::enableControl<T> operator<<(\n  std::ostream &os, T const value)\n{\n\tif (value == rang::control::offColor) {\n\t\trang_implementation::controlValue() = 0;\n\t} else if (value == rang::control::autoColor) {\n\t\trang_implementation::controlValue() = 1;\n\t} else if (value == rang::control::forceColor) {\n\t\trang_implementation::controlValue() = 2;\n\t}\n\treturn os;\n}\n}\n\n#undef OS_LINUX\n#undef OS_WIN\n#undef OS_MAC\n\n#endif /* ifndef RANG_DOT_HPP */\n","filetypes":["cpp"]}},"line_num":9,"column_num":9,"command_arguments":["FixIt"],"completer_target":"filetype_default"}
[buildRequest] document, /home/agauniyal/projects/rang/include/rang.hpp; position: [object Object]; event: null
[_request] {"filepath":"/home/agauniyal/projects/rang/include/rang.hpp","working_dir":"/home/agauniyal/projects/rang","file_data":{"/home/agauniyal/projects/rang/include/rang.hpp":{"contents":"#ifndef RANG_DOT_HPP\n#define RANG_DOT_HPP\n\n#if defined(__unix__) || defined(__unix) || defined(__linux__)\n#define OS_LINUX\n#elif defined(WIN32) || defined(_WIN32) || defined(_WIN64)\n#define OS_WIN\n#elif defined(__APPLE__) || defined(__MACH__)\n#define OS_MAC\n#else\n#error Unknown Platform\n#endif\n\n#if defined(OS_LINUX) || defined(OS_MAC)\n#include <unistd.h>\n#include <cstring>\n#elif defined(OS_WIN)\n#include <windows.h>\n#include <io.h>\n#include <VersionHelpers.h>\n#endif\n\n#include <algorithm>\n#include <cstdlib>\n#include <ios>\n#include <iostream>\n#include <iterator>\n#include <type_traits>\n#include <atomic>\n\nnamespace rang {\n\nenum class style {\n\treset     = 0,\n\tbold      = 1,\n\tdim       = 2,\n\titalic    = 3,\n\tunderline = 4,\n\tblink     = 5,\n\trblink    = 6,\n\treversed  = 7,\n\tconceal   = 8,\n\tcrossed   = 9\n};\n\nenum class fg {\n\tblack   = 30,\n\tred     = 31,\n\tgreen   = 32,\n\tyellow  = 33,\n\tblue    = 34,\n\tmagenta = 35,\n\tcyan    = 36,\n\tgray    = 37,\n\treset   = 39\n};\n\nenum class bg {\n\tblack   = 40,\n\tred     = 41,\n\tgreen   = 42,\n\tyellow  = 43,\n\tblue    = 44,\n\tmagenta = 45,\n\tcyan    = 46,\n\tgray    = 47,\n\treset   = 49\n};\n\nenum class fgB {\n\tblack   = 90,\n\tred     = 91,\n\tgreen   = 92,\n\tyellow  = 93,\n\tblue    = 94,\n\tmagenta = 95,\n\tcyan    = 96,\n\tgray    = 97\n};\n\nenum class bgB {\n\tblack   = 100,\n\tred     = 101,\n\tgreen   = 102,\n\tyellow  = 103,\n\tblue    = 104,\n\tmagenta = 105,\n\tcyan    = 106,\n\tgray    = 107\n};\n\nenum class control { offColor = 0, autoColor = 1, forceColor = 2 };\n\n\nnamespace rang_implementation {\n\n\n\tinline std::streambuf const *&RANG_coutbuf()\n\t{\n\t\tstatic std::streambuf const *pOutbuff = std::cout.rdbuf();\n\t\treturn pOutbuff;\n\t}\n\n\tinline std::streambuf const *&RANG_cerrbuf()\n\t{\n\t\tstatic std::streambuf const *pErrbuff = std::cerr.rdbuf();\n\t\treturn pErrbuff;\n\t}\n\n\tinline std::streambuf const *&RANG_clogbuf()\n\t{\n\t\tstatic std::streambuf const *pLogbuff = std::clog.rdbuf();\n\t\treturn pLogbuff;\n\t}\n\n\n\tinline std::atomic<int> &controlValue()\n\t{\n\t\tstatic std::atomic<int> value(1);\n\t\treturn value;\n\t}\n\n\n\tinline bool supportsColor()\n\t{\n#if defined(OS_LINUX) || defined(OS_MAC)\n\t\tstatic constexpr const char *Terms[] = {\n\t\t\t\"ansi\", \"color\", \"console\", \"cygwin\", \"gnome\", \"konsole\", \"kterm\",\n\t\t\t\"linux\", \"msys\", \"putty\", \"rxvt\", \"screen\", \"vt100\", \"xterm\"\n\t\t};\n\n\t\tstatic const char *env_p = std::getenv(\"TERM\");\n\n\t\tstatic const bool result = (env_p == nullptr)\n\t\t  ? false\n\t\t  : std::any_of(\n\t\t      std::begin(Terms), std::end(Terms), [](const char *term) {\n\t\t\t      return std::strstr(env_p, term) != nullptr;\n\t\t\t  });\n\n#elif defined(OS_WIN)\n\t\tstatic constexpr bool result = true;\n#endif\n\t\treturn result;\n\t}\n\n\n\tinline bool isTerminal(const std::streambuf *osbuf)\n\t{\n\t\tif (osbuf == RANG_coutbuf()) {\n#if defined(OS_LINUX) || defined(OS_MAC)\n\t\t\treturn isatty(fileno(stdout)) ? true : false;\n#elif defined(OS_WIN)\n\t\t\treturn _isatty(_fileno(stdout)) ? true : false;\n#endif\n\t\t}\n\n\t\tif (osbuf == RANG_cerrbuf() || osbuf == RANG_clogbuf()) {\n#if defined(OS_LINUX) || defined(OS_MAC)\n\t\t\treturn isatty(fileno(stderr)) ? true : false;\n#elif defined(OS_WIN)\n\t\t\treturn _isatty(_fileno(stderr)) ? true : false;\n#endif\n\t\t}\n\t\treturn false;\n\t}\n\n\n\ttemplate <typename T>\n\tusing enableStd =\n\t  typename std::enable_if<std::is_same<T, rang::style>::value\n\t      || std::is_same<T, rang::fg>::value\n\t      || std::is_same<T, rang::bg>::value\n\t      || std::is_same<T, rang::fgB>::value\n\t      || std::is_same<T, rang::bgB>::value,\n\t    std::ostream &>::type;\n\n\n#ifdef OS_WIN\n\tHANDLE getVersionDependentHandle()\n\t{\n\t\tif (IsWindowsVersionOrGreater(10, 0, 0)) return nullptr;\n\t\treturn GetStdHandle(STD_OUTPUT_HANDLE);\n\t}\n\n\tinline HANDLE getConsoleHandle()\n\t{\n\t\tstatic HANDLE h = getVersionDependentHandle();\n\t\treturn h;\n\t}\n\n\tinline WORD reverseRGB(WORD rgb)\n\t{\n\t\tstatic const WORD rev[8] = { 0, 4, 2, 6, 1, 5, 3, 7 };\n\t\treturn rev[rgb];\n\t}\n\n\tinline void setWinAttribute(rang::bg col, WORD &state)\n\t{\n\t\tstate &= 0xFF0F;\n\t\tstate |= reverseRGB(static_cast<WORD>(col) - 40) << 4;\n\t}\n\n\tinline void setWinAttribute(rang::fg col, WORD &state)\n\t{\n\t\tstate &= 0xFFF0;\n\t\tstate |= reverseRGB(static_cast<WORD>(col) - 30);\n\t}\n\n\tinline void setWinAttribute(rang::bgB col, WORD &state)\n\t{\n\t\tstate &= 0xFF0F;\n\t\tstate |= (0x8 | reverseRGB(static_cast<WORD>(col) - 100)) << 4;\n\t}\n\n\tinline void setWinAttribute(rang::fgB col, WORD &state)\n\t{\n\t\tstate &= 0xFFF0;\n\t\tstate |= (0x8 | reverseRGB(static_cast<WORD>(col) - 90));\n\t}\n\n\tinline void setWinAttribute(rang::style style, WORD &state)\n\t{\n\t\tif (style == rang::style::reset) {\n\t\t\tstate = (FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED);\n\t\t}\n\t}\n\n\tinline WORD &current_state()\n\t{\n\t\tstatic WORD state\n\t\t  = (FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED);\n\t\treturn state;\n\t}\n\n\n\ttemplate <typename T>\n\tinline enableStd<T> setColor(std::ostream &os, T const value)\n\t{\n\t\tHANDLE h = getConsoleHandle();\n\t\tif (h && isTerminal(os.rdbuf())) {\n\t\t\tsetWinAttribute(value, current_state());\n\t\t\tSetConsoleTextAttribute(h, current_state());\n\t\t\treturn os;\n\t\t}\n\t\treturn os << \"\\033[\" << static_cast<int>(value) << \"m\";\n\t}\n#else\n\ttemplate <typename T>\n\tinline enableStd<T> setColor(std::ostream &os, T const value)\n\t{\n\t\treturn os << \"\\033[\" << static_cast<int>(value) << \"m\";\n\t}\n#endif\n\n\ttemplate <typename T>\n\tusing enableControl =\n\t  typename std::enable_if<std::is_same<T, rang::control>::value,\n\t    std::ostream &>::type;\n}\n\n\nvoid init()\n{\n\trang_implementation::RANG_coutbuf();\n\trang_implementation::RANG_cerrbuf();\n\trang_implementation::RANG_clogbuf();\n}\n\n\ntemplate <typename T>\ninline rang_implementation::enableStd<T> operator<<(\n  std::ostream &os, T const value)\n{\n\tconst int option = rang_implementation::controlValue();\n\tswitch (option) {\n\t\tcase 0: return os;\n\t\tcase 1:\n\t\t\treturn rang_implementation::supportsColor()\n\t\t\t    && rang_implementation::isTerminal(os.rdbuf())\n\t\t\t  ? rang_implementation::setColor(os, value)\n\t\t\t  : os;\n\t\tcase 2: return rang_implementation::setColor(os, value);\n\t\tdefault: return os;\n\t}\n}\n\n\ntemplate <typename T>\ninline rang_implementation::enableControl<T> operator<<(\n  std::ostream &os, T const value)\n{\n\tif (value == rang::control::offColor) {\n\t\trang_implementation::controlValue() = 0;\n\t} else if (value == rang::control::autoColor) {\n\t\trang_implementation::controlValue() = 1;\n\t} else if (value == rang::control::forceColor) {\n\t\trang_implementation::controlValue() = 2;\n\t}\n\treturn os;\n}\n}\n\n#undef OS_LINUX\n#undef OS_WIN\n#undef OS_MAC\n\n#endif /* ifndef RANG_DOT_HPP */\n","filetypes":["cpp"]}},"line_num":9,"column_num":9,"command_arguments":["FixIt"],"completer_target":"filetype_default"}
[buildRequest] document, /home/agauniyal/projects/rang/include/rang.hpp; position: [object Object]; event: null
[_request] {"filepath":"/home/agauniyal/projects/rang/include/rang.hpp","working_dir":"/home/agauniyal/projects/rang","file_data":{"/home/agauniyal/projects/rang/include/rang.hpp":{"contents":"#ifndef RANG_DOT_HPP\n#define RANG_DOT_HPP\n\n#if defined(__unix__) || defined(__unix) || defined(__linux__)\n#define OS_LINUX\n#elif defined(WIN32) || defined(_WIN32) || defined(_WIN64)\n#define OS_WIN\n#elif defined(__APPLE__) || defined(__MACH__)\n#define OS_MAC\n#else\n#error Unknown Platform\n#endif\n\n#if defined(OS_LINUX) || defined(OS_MAC)\n#include <unistd.h>\n#include <cstring>\n#elif defined(OS_WIN)\n#include <windows.h>\n#include <io.h>\n#include <VersionHelpers.h>\n#endif\n\n#include <algorithm>\n#include <cstdlib>\n#include <ios>\n#include <iostream>\n#include <iterator>\n#include <type_traits>\n#include <atomic>\n\nnamespace rang {\n\nenum class style {\n\treset     = 0,\n\tbold      = 1,\n\tdim       = 2,\n\titalic    = 3,\n\tunderline = 4,\n\tblink     = 5,\n\trblink    = 6,\n\treversed  = 7,\n\tconceal   = 8,\n\tcrossed   = 9\n};\n\nenum class fg {\n\tblack   = 30,\n\tred     = 31,\n\tgreen   = 32,\n\tyellow  = 33,\n\tblue    = 34,\n\tmagenta = 35,\n\tcyan    = 36,\n\tgray    = 37,\n\treset   = 39\n};\n\nenum class bg {\n\tblack   = 40,\n\tred     = 41,\n\tgreen   = 42,\n\tyellow  = 43,\n\tblue    = 44,\n\tmagenta = 45,\n\tcyan    = 46,\n\tgray    = 47,\n\treset   = 49\n};\n\nenum class fgB {\n\tblack   = 90,\n\tred     = 91,\n\tgreen   = 92,\n\tyellow  = 93,\n\tblue    = 94,\n\tmagenta = 95,\n\tcyan    = 96,\n\tgray    = 97\n};\n\nenum class bgB {\n\tblack   = 100,\n\tred     = 101,\n\tgreen   = 102,\n\tyellow  = 103,\n\tblue    = 104,\n\tmagenta = 105,\n\tcyan    = 106,\n\tgray    = 107\n};\n\nenum class control { offColor = 0, autoColor = 1, forceColor = 2 };\n\n\nnamespace rang_implementation {\n\n\n\tinline std::streambuf const *&RANG_coutbuf()\n\t{\n\t\tstatic std::streambuf const *pOutbuff = std::cout.rdbuf();\n\t\treturn pOutbuff;\n\t}\n\n\tinline std::streambuf const *&RANG_cerrbuf()\n\t{\n\t\tstatic std::streambuf const *pErrbuff = std::cerr.rdbuf();\n\t\treturn pErrbuff;\n\t}\n\n\tinline std::streambuf const *&RANG_clogbuf()\n\t{\n\t\tstatic std::streambuf const *pLogbuff = std::clog.rdbuf();\n\t\treturn pLogbuff;\n\t}\n\n\n\tinline std::atomic<int> &controlValue()\n\t{\n\t\tstatic std::atomic<int> value(1);\n\t\treturn value;\n\t}\n\n\n\tinline bool supportsColor()\n\t{\n#if defined(OS_LINUX) || defined(OS_MAC)\n\t\tstatic constexpr const char *Terms[] = {\n\t\t\t\"ansi\", \"color\", \"console\", \"cygwin\", \"gnome\", \"konsole\", \"kterm\",\n\t\t\t\"linux\", \"msys\", \"putty\", \"rxvt\", \"screen\", \"vt100\", \"xterm\"\n\t\t};\n\n\t\tstatic const char *env_p = std::getenv(\"TERM\");\n\n\t\tstatic const bool result = (env_p == nullptr)\n\t\t  ? false\n\t\t  : std::any_of(\n\t\t      std::begin(Terms), std::end(Terms), [](const char *term) {\n\t\t\t      return std::strstr(env_p, term) != nullptr;\n\t\t\t  });\n\n#elif defined(OS_WIN)\n\t\tstatic constexpr bool result = true;\n#endif\n\t\treturn result;\n\t}\n\n\n\tinline bool isTerminal(const std::streambuf *osbuf)\n\t{\n\t\tif (osbuf == RANG_coutbuf()) {\n#if defined(OS_LINUX) || defined(OS_MAC)\n\t\t\treturn isatty(fileno(stdout)) ? true : false;\n#elif defined(OS_WIN)\n\t\t\treturn _isatty(_fileno(stdout)) ? true : false;\n#endif\n\t\t}\n\n\t\tif (osbuf == RANG_cerrbuf() || osbuf == RANG_clogbuf()) {\n#if defined(OS_LINUX) || defined(OS_MAC)\n\t\t\treturn isatty(fileno(stderr)) ? true : false;\n#elif defined(OS_WIN)\n\t\t\treturn _isatty(_fileno(stderr)) ? true : false;\n#endif\n\t\t}\n\t\treturn false;\n\t}\n\n\n\ttemplate <typename T>\n\tusing enableStd =\n\t  typename std::enable_if<std::is_same<T, rang::style>::value\n\t      || std::is_same<T, rang::fg>::value\n\t      || std::is_same<T, rang::bg>::value\n\t      || std::is_same<T, rang::fgB>::value\n\t      || std::is_same<T, rang::bgB>::value,\n\t    std::ostream &>::type;\n\n\n#ifdef OS_WIN\n\tHANDLE getVersionDependentHandle()\n\t{\n\t\tif (IsWindowsVersionOrGreater(10, 0, 0)) return nullptr;\n\t\treturn GetStdHandle(STD_OUTPUT_HANDLE);\n\t}\n\n\tinline HANDLE getConsoleHandle()\n\t{\n\t\tstatic HANDLE h = getVersionDependentHandle();\n\t\treturn h;\n\t}\n\n\tinline WORD reverseRGB(WORD rgb)\n\t{\n\t\tstatic const WORD rev[8] = { 0, 4, 2, 6, 1, 5, 3, 7 };\n\t\treturn rev[rgb];\n\t}\n\n\tinline void setWinAttribute(rang::bg col, WORD &state)\n\t{\n\t\tstate &= 0xFF0F;\n\t\tstate |= reverseRGB(static_cast<WORD>(col) - 40) << 4;\n\t}\n\n\tinline void setWinAttribute(rang::fg col, WORD &state)\n\t{\n\t\tstate &= 0xFFF0;\n\t\tstate |= reverseRGB(static_cast<WORD>(col) - 30);\n\t}\n\n\tinline void setWinAttribute(rang::bgB col, WORD &state)\n\t{\n\t\tstate &= 0xFF0F;\n\t\tstate |= (0x8 | reverseRGB(static_cast<WORD>(col) - 100)) << 4;\n\t}\n\n\tinline void setWinAttribute(rang::fgB col, WORD &state)\n\t{\n\t\tstate &= 0xFFF0;\n\t\tstate |= (0x8 | reverseRGB(static_cast<WORD>(col) - 90));\n\t}\n\n\tinline void setWinAttribute(rang::style style, WORD &state)\n\t{\n\t\tif (style == rang::style::reset) {\n\t\t\tstate = (FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED);\n\t\t}\n\t}\n\n\tinline WORD &current_state()\n\t{\n\t\tstatic WORD state\n\t\t  = (FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED);\n\t\treturn state;\n\t}\n\n\n\ttemplate <typename T>\n\tinline enableStd<T> setColor(std::ostream &os, T const value)\n\t{\n\t\tHANDLE h = getConsoleHandle();\n\t\tif (h && isTerminal(os.rdbuf())) {\n\t\t\tsetWinAttribute(value, current_state());\n\t\t\tSetConsoleTextAttribute(h, current_state());\n\t\t\treturn os;\n\t\t}\n\t\treturn os << \"\\033[\" << static_cast<int>(value) << \"m\";\n\t}\n#else\n\ttemplate <typename T>\n\tinline enableStd<T> setColor(std::ostream &os, T const value)\n\t{\n\t\treturn os << \"\\033[\" << static_cast<int>(value) << \"m\";\n\t}\n#endif\n\n\ttemplate <typename T>\n\tusing enableControl =\n\t  typename std::enable_if<std::is_same<T, rang::control>::value,\n\t    std::ostream &>::type;\n}\n\n\nvoid init()\n{\n\trang_implementation::RANG_coutbuf();\n\trang_implementation::RANG_cerrbuf();\n\trang_implementation::RANG_clogbuf();\n}\n\n\ntemplate <typename T>\ninline rang_implementation::enableStd<T> operator<<(\n  std::ostream &os, T const value)\n{\n\tconst int option = rang_implementation::controlValue();\n\tswitch (option) {\n\t\tcase 0: return os;\n\t\tcase 1:\n\t\t\treturn rang_implementation::supportsColor()\n\t\t\t    && rang_implementation::isTerminal(os.rdbuf())\n\t\t\t  ? rang_implementation::setColor(os, value)\n\t\t\t  : os;\n\t\tcase 2: return rang_implementation::setColor(os, value);\n\t\tdefault: return os;\n\t}\n}\n\n\ntemplate <typename T>\ninline rang_implementation::enableControl<T> operator<<(\n  std::ostream &os, T const value)\n{\n\tif (value == rang::control::offColor) {\n\t\trang_implementation::controlValue() = 0;\n\t} else if (value == rang::control::autoColor) {\n\t\trang_implementation::controlValue() = 1;\n\t} else if (value == rang::control::forceColor) {\n\t\trang_implementation::controlValue() = 2;\n\t}\n\treturn os;\n}\n}\n\n#undef OS_LINUX\n#undef OS_WIN\n#undef OS_MAC\n\n#endif /* ifndef RANG_DOT_HPP */\n","filetypes":["cpp"]}},"line_num":9,"column_num":9,"command_arguments":["FixIt"],"completer_target":"filetype_default"}
events.js:160
      throw er; // Unhandled 'error' event
      ^

Error: connect ECONNREFUSED 127.0.0.1:35627
    at Object.exports._errnoException (util.js:1026:11)
    at exports._exceptionWithHostPort (util.js:1049:20)
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1081:14)
[Error - 1:01:47 PM] Connection to server got closed. Server will not be restarted.
richard1122 commented 7 years ago

@agauniyal I released 1.0.32 version just now. Add more logs and more exception handling.

Please hava a try!

richard1122 commented 7 years ago

@agauniyal 1.0.33 just released...

agauniyal commented 7 years ago

@richard1122 it's solved 😸 , I've tested your plugin for 2 days and finally it works as expected. I'll reopen if I encounter this in future but I'm gonna close this for now. Thanks for your swift support πŸ‘