├── .vscode └── launch.json ├── README.md ├── nginx.configuration.json ├── nginx_logo.png ├── package.json ├── syntaxes └── nginx.tmLanguage └── vsc-extension-quickstart.md /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | // A launch configuration that launches the extension inside a new window 2 | { 3 | "version": "0.1.0", 4 | "configurations": [ 5 | { 6 | "name": "Launch Extension", 7 | "type": "extensionHost", 8 | "request": "launch", 9 | "runtimeExecutable": "${execPath}", 10 | "args": ["--extensionDevelopmentPath=${workspaceRoot}" ] 11 | } 12 | ] 13 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # NGINX syntax support for VS Code 2 | Syntax highlighing for nginx conf files in Visual Studio Code. Ported from [johnmuhl/nginx-tmbundle][1]. 3 | 4 | ## Installation 5 | Launch Code's command palette (Ctrl + P) and type 6 | 7 | ext install vscode-nginx 8 | 9 | This extension is published on the [VSCode marketplace][2]. 10 | 11 | [1]: https://github.com/johnmuhl/nginx-tmbundle 12 | [2]: https://marketplace.visualstudio.com/items?itemName=shanoor.vscode-nginx 13 | -------------------------------------------------------------------------------- /nginx.configuration.json: -------------------------------------------------------------------------------- 1 | { 2 | "comments": { 3 | // symbol used for single line comment. Remove this entry if your language does not support line comments 4 | "lineComment": "#" 5 | }, 6 | // symbols used as brackets 7 | "brackets": [ 8 | ["{", "}"], 9 | ["[", "]"], 10 | ["(", ")"] 11 | ] 12 | } 13 | -------------------------------------------------------------------------------- /nginx_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shanoor/vscode-nginx/54d1374b376d5a43949f183e72c72e22cd4c7d65/nginx_logo.png -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "vscode-nginx", 3 | "displayName": "nginx.conf", 4 | "description": "Syntax highlighter for nginx conf files.", 5 | "version": "0.6.0", 6 | "publisher": "shanoor", 7 | "engines": { 8 | "vscode": "^1.0.0" 9 | }, 10 | "repository": { 11 | "type": "GitHub", 12 | "url": "https://github.com/shanoor/vscode-nginx" 13 | }, 14 | "categories": [ 15 | "Languages" 16 | ], 17 | "contributes": { 18 | "languages": [ 19 | { 20 | "id": "NGINX", 21 | "aliases": [ 22 | "NGINX" 23 | ], 24 | "extensions": [ 25 | ".conf" 26 | ], 27 | "configuration": "./nginx.configuration.json" 28 | } 29 | ], 30 | "grammars": [ 31 | { 32 | "language": "NGINX", 33 | "scopeName": "source.nginx", 34 | "path": "./syntaxes/nginx.tmLanguage" 35 | } 36 | ] 37 | }, 38 | "icon": "nginx_logo.png" 39 | } 40 | -------------------------------------------------------------------------------- /syntaxes/nginx.tmLanguage: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | fileTypes 6 | 7 | conf 8 | nginx 9 | 10 | foldingStartMarker 11 | \{\s*$ 12 | foldingStopMarker 13 | ^\s*\} 14 | keyEquivalent 15 | ^~N 16 | name 17 | nginx 18 | patterns 19 | 20 | 21 | match 22 | \#.* 23 | name 24 | comment 25 | 26 | 27 | match 28 | \b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}(:\d{1,5})?\b 29 | name 30 | constant.numeric 31 | 32 | 33 | match 34 | \b\d+\w+\b 35 | name 36 | constant.numeric 37 | 38 | 39 | match 40 | \{|\} 41 | name 42 | constant.character.brace 43 | 44 | 45 | match 46 | \; 47 | name 48 | constant.character.end 49 | 50 | 51 | match 52 | \(|\) 53 | name 54 | constant.character.paren 55 | 56 | 57 | match 58 | \" 59 | name 60 | constant.character.quote 61 | 62 | 63 | match 64 | \\.*\ |\~|\~\*|\!\~|\!\~\* 65 | name 66 | string.regexp 67 | 68 | 69 | match 70 | \"(.*)\" 71 | name 72 | string.quoted 73 | 74 | 75 | match 76 | \'(.*)\' 77 | name 78 | string.quoted 79 | 80 | 81 | match 82 | \b(events)\b 83 | name 84 | constant.language.module.events 85 | 86 | 87 | match 88 | \b^(http)\b 89 | name 90 | constant.language.module.http 91 | 92 | 93 | match 94 | \b(daemon|env|debug_points|error_log|log_not_found|include|lock_file|master_process|pid|ssl_engine|timer_resolution|types_hash_max_size|user|worker_cpu_affinity|worker_priority|worker_processes|worker_rlimit_core|worker_rlimit_nofile|worker_rlimit_sigpending|working_directory|try_files)\b 95 | name 96 | constant.language.directive.module.main 97 | 98 | 99 | match 100 | \b(accept_mutex|accept_mutex_delay|debug_connection|devpoll_changes|devpoll_events|epoll_events|kqueue_changes|kqueue_events|multi_accept|rtsig_signo|rtsig_overflow_events|rtsig_overflow_test|rtsig_overflow_threshold|use|worker_connections)\b 101 | name 102 | constant.language.directive.module.events 103 | 104 | 105 | match 106 | \b(alias|chunked_transfer_encoding|client_body_in_file_only|client_body_buffer_size|client_body_temp_path|client_body_timeout|client_header_buffer_size|client_header_timeout|client_max_body_size|default_type|error_page|index\ |internal|keepalive_timeout|keepalive_requests|large_client_header_buffers|limit_except|limit_rate|listen|location|msie_padding|msie_refresh|optimize_server_names|port_in_redirect|recursive_error_pages|reset_timedout_connection|resolver|resolver_timeout|root|satisfy_any|send_timeout|sendfile|server|server_name|server_names_hash_max_size|server_names_hash_bucket_size|tcp_nodelay|tcp_nopush|types\ |try_files)\b 107 | name 108 | constant.language.directive.module.http 109 | 110 | 111 | match 112 | \b(add_before_body|add_after_body|addition_types)\b 113 | name 114 | constant.language.module.http.addition 115 | 116 | 117 | match 118 | \b(allow|deny)\b 119 | name 120 | constant.language.module.http.access 121 | 122 | 123 | match 124 | \b(auth_basic|auth_basic_user_file)\b 125 | name 126 | constant.language.module.http.auth_basic 127 | 128 | 129 | match 130 | \b(auth_jwt|auth_jwt_header_set|auth_jwt_claim_set|auth_jwt_key_file)\b 131 | name 132 | constant.language.module.http.auth_jwt 133 | 134 | 135 | match 136 | \b(autoindex|autoindex_exact_size|autoindex_format|autoindex_localtime)\b 137 | name 138 | constant.language.module.http.autoindex 139 | 140 | 141 | match 142 | \b(ancient_browser|ancient_browser_value|modern_browser|modern_browser_value)\b 143 | name 144 | constant.language.module.http.browser 145 | 146 | 147 | match 148 | \b(charset|charset_map|override_charset|source_charset)\b 149 | name 150 | constant.language.module.http.charset 151 | 152 | 153 | match 154 | \b(empty_gif)\b 155 | name 156 | constant.language.module.http.empty_gif 157 | 158 | 159 | match 160 | \b(fastcgi_index|fastcgi_hide_header|fastcgi_ignore_client_abort|fastcgi_intercept_errors|fastcgi_param|fastcgi_pass|fastcgi_pass_header|fastcgi_read_timeout|fastcgi_redirect_errors|fa|stcgi_storefastcgi_store_access|fastcgi_buffers|fastcgi_buffers_size|fastcgi_temp_path|fastcgi_buffer_size|fastcgi_connect_timeout|fastcgi_send_timeout|fastcgi_split_path_info)\b 161 | name 162 | constant.language.module.http.fastcgi 163 | 164 | 165 | match 166 | \b(geo)\b 167 | name 168 | constant.language.module.http.geo 169 | 170 | 171 | match 172 | \b(gzip|gzip_buffers|gzip_comp_level|gzip_disable|gzip_http.version|gzip_min_length|gzip_proxied|gzip_types|gzip_vary)\b 173 | name 174 | constant.language.module.http.gzip 175 | 176 | 177 | match 178 | \b(add_header|expires|server_tokens)\b 179 | name 180 | constant.language.module.http.headers 181 | 182 | 183 | match 184 | \b(valid_referers)\b 185 | name 186 | constant.language.module.http.referer 187 | 188 | 189 | match 190 | \b(limit_zone|limit_conn)\b 191 | name 192 | constant.language.module.http.limit_zone 193 | 194 | 195 | match 196 | \b(limit_req|limit_req_log_level|limit_req_status|limit_req_zone)\b 197 | name 198 | constant.language.module.http.limit_req 199 | 200 | 201 | match 202 | \b(access_log|log_format)\b 203 | name 204 | constant.language.module.http.log 205 | 206 | 207 | match 208 | \b(map|map_hash_max_size|map_hash_bucket_size)\b 209 | name 210 | constant.language.module.http.map 211 | 212 | 213 | match 214 | \b(memcached_pass|memcached_connect_timeout|memcached_send_timeout|memcached_read_timeout|memcached_buffer_size|memcached_next_upstream)\b 215 | name 216 | constant.language.module.http.memcached 217 | 218 | 219 | match 220 | \b(proxy_buffer_size|proxy_buffering|proxy_buffers|proxy_busy_buffers_size|proxy_cache|proxy_cache_background_update|proxy_cache_bypass|proxy_cache_convert_head|proxy_cache_key|proxy_cache_lock|proxy_cache_lock_age|proxy_cache_lock_timeout|proxy_cache_max_range_offset|proxy_cache_methods|proxy_cache_min_uses|proxy_cache_path|proxy_cache_purge|proxy_cache_revalidate|proxy_cache_use_stale|proxy_cache_valid|proxy_connect_timeout|proxy_headers_hash_bucket_size|proxy_headers_hash_max_size|proxy_hide_header|proxy_http_version|proxy_ignore_client_abort|proxy_intercept_errors|proxy_max_temp_file_size|proxy_method|proxy_next_upstream|proxy_next_upstream_tries|proxy_next_upstream_timeout|proxy_pass|proxy_pass_header|proxy_pass_request_body|proxy_pass_request_headers|proxy_read_timeout|proxy_redirect|proxy_redirect_errors|proxy_send_lowat|proxy_send_timeout|proxy_set_body|proxy_set_header|proxy_store|proxy_store_access|proxy_temp_file_write_size|proxy_t|emp_pathproxy_upstream_fail_timeout|proxy_upstream_max_fails|proxy_no_cache)\b 221 | name 222 | constant.language.module.http.proxy 223 | 224 | 225 | match 226 | \b(set_real_ip_from|real_ip_header|real_ip_recursive)\b 227 | name 228 | constant.language.module.http.realip 229 | 230 | 231 | match 232 | \b(break|if|return|reqrite|set|uninitialized_variable_warn)\b 233 | name 234 | constant.language.module.http.rewrite 235 | 236 | 237 | match 238 | \b(ssi|ssi_silent_errors|ssi_types|ssi_value_length)\b 239 | name 240 | constant.language.module.http.ssi 241 | 242 | 243 | match 244 | \b(ip_hash|upstream|server)\b 245 | name 246 | constant.language.module.http.upstream 247 | 248 | 249 | match 250 | \b(userid|userid_domain|userid_expires|userid_name|userid_p3p|userid_path|userid_service)\b 251 | name 252 | constant.language.module.http.userid 253 | 254 | 255 | match 256 | \b(uwsgi_bind|uwsgi_buffer_size|uwsgi_buffering|uwsgi_buffers|uwsgi_busy_buffers_size|uwsgi_cache|uwsgi_cache_background_update|uwsgi_cache_bypass|uwsgi_cache_key|uwsgi_cache_lock|uwsgi_cache_lock_age|uwsgi_cache_lock_timeout|uwsgi_cache_max_range_offset|uwsgi_cache_methods|uwsgi_cache_min_uses|uwsgi_cache_path|uwsgi_cache_purge|uwsgi_cache_revalidate|uwsgi_cache_use_stale|uwsgi_cache_valid|uwsgi_connect_timeout|uwsgi_force_ranges|uwsgi_hide_header|uwsgi_ignore_client_abort|uwsgi_ignore_headers|uwsgi_intercept_errors|uwsgi_limit_rate|uwsgi_max_temp_file_size|uwsgi_modifier1|uwsgi_modifier2|uwsgi_next_upstream|uwsgi_next_upstream_timeout|uwsgi_next_upstream_tries|uwsgi_no_cache|uwsgi_param|uwsgi_pass|uwsgi_pass_header|uwsgi_pass_request_body|uwsgi_pass_request_headers|uwsgi_read_timeout|uwsgi_request_buffering|uwsgi_send_timeout|uwsgi_ssl_certificate|uwsgi_ssl_certificate_key|uwsgi_ssl_ciphers|uwsgi_ssl_crl|uwsgi_ssl_name|uwsgi_ssl_password_file|uwsgi_ssl_protocols|uwsgi_ssl_server_name|uwsgi_ssl_session_reuse|uwsgi_ssl_trusted_certificate|uwsgi_ssl_verify|uwsgi_ssl_verify_depth|uwsgi_store|uwsgi_store_access|uwsgi_temp_file_write_size|uwsgi_temp_path)\b 257 | name 258 | constant.language.module.http.uwsgi 259 | 260 | 261 | match 262 | \b(ssl|ssl_buffer_size|ssl_certificate|ssl_certificate_key|ssl_ciphers|ssl_client_certificate|ssl_crl|ssl_dhparam|ssl_ecdh_curve|ssl_password_file|ssl_prefer_server_ciphers|ssl_protocols|ssl_session_cache|ssl_session_ticket_key|ssl_session_tickets|ssl_session_timeout|ssl_stapling|ssl_stapling_file|ssl_stapling_responder|ssl_stapling_verify|ssl_trusted_certificate|ssl_verify_client|ssl_verify_depth)\b 263 | name 264 | constant.language.directive.module.http 265 | 266 | 267 | match 268 | \$\w+ 269 | name 270 | variable 271 | 272 | 273 | scopeName 274 | source.nginx 275 | uuid 276 | 0C04066A-12D2-43CA-8238-00A12CE4C12D 277 | 278 | 279 | -------------------------------------------------------------------------------- /vsc-extension-quickstart.md: -------------------------------------------------------------------------------- 1 | # Welcome to your VS Code Extension 2 | 3 | ## What's in the folder 4 | * This folder contains all of the files necessary for your extension 5 | * `package.json` - this is the manifest file in which you declare your language support and define 6 | the location of the grammar file that has been copied into you extension. 7 | * `syntaxes/nginx.tmLanguage` - this is the Text mate grammar file that is used for tokenization 8 | * `nginx.configuration.json` - this the language configuration, defining the tokens that are used for 9 | comments and brackets. 10 | 11 | ## Get up and running straight away 12 | * Make sure the language configuration settings in `nginx.configuration.json` are accurate 13 | * press `F5` to open a new window with your extension loaded 14 | * create a new file with a file name suffix matching your language 15 | * verify that syntax highlight works and that the language configuration settings are working 16 | 17 | ## Make changes 18 | * you can relaunch the extension from the debug toolbar after making changes to the files listed above 19 | * you can also reload (`Ctrl+R` or `Cmd+R` on Mac) the VS Code window with your extension to load your changes 20 | 21 | ## Add more language features 22 | * To add features such as intellisense, hovers and validators check out the VS Code extenders documentation at 23 | https://code.visualstudio.com/docs 24 | 25 | ## Install your extension 26 | * To start using your extension with Visual Studio Code copy it into the /.vscode/extensions folder and restart Code. 27 | * To share your extension with the world, read on https://code.visualstudio.com/docs about publishing an extension. --------------------------------------------------------------------------------