Sublime Forum

Tuning Auto Complete

#1

Hi,

Is there any way to tune Auto Complete feature, so that it DOES NOT show words that were used in comments?

Thanks!

2 Likes

#2

Yes, there is a way. Is is a nice way? I do not think so.

You can override the Sublime Text completions with a package. On this package you would have to parse you whole file and decide whether or not to show the words based on their syntax scope. So, everything which has not the comment on its scope, is not included on the output list sent to Sublime Text.

I do not know any package which currently does that. You may search for one. If you did not find you could write one. I did something similar for the Amxx Pawn programming language using another similar package as base. The difference is that you can only autocomplete the functions of a file. You can look into its code on:

  1. https://github.com/evandrocoan/SublimeAMXX_Editor/blob/master/AMXXEditor.py

This is the settings file which control the options I added:

```javascript { // Path to includes folder, the files here will be used for auto completion. "include_directory": "C:\\amxmodx\\scripting\\include\\",

// ( true / false ) Enable the parameters addition when auto completing.
"add_function_parameters": true,

// ( true / false ) Enable IntelTip PopUp
"enable_inteltip": false,

// ( true / false ) Enable Auto-Increment Build/Version
"enable_buildversion": false,

// ( true / false ) Enable auto completing functions and global variables from the current file.
// If you change this setting, you need to restart Sublime Text before it can take effect.
"function_autocomplete": true,

// ( true / false ) Enable auto completing words from the current file.
"word_autocomplete": true,

// ( true / false ) Enable to add word completions from all opened files.
"use_all_autocomplete": true,

// Enable editor debug messages, see the file `amxmodx/AMXXEditor.py` for all debugging levels.
//
// 0 - Disabled debugging.
// 1 - Errors messages.
//
"debug_level": 1,

// ( color name ) Set color scheme ( dark / twlight / atomic / white / npp )
"color_scheme": "dark",

// The new file syntax when using the menu `Amx Mod X -> New Plug-in`. Possible values are:
//
// "Packages/Amxx Pawn/AmxxPawn.sublime-syntax"
// "Packages/amxmodx/AMXX-Pawn.sublime-syntax"
//
"amxx_file_syntax": "Packages/Amxx Pawn/AmxxPawn.sublime-syntax",

// ( 0.5 ~ 5.0 ) Delay before regenerating auto-completion snippets
"live_refresh_delay":   1.0

}

</p>
</details>

Currently I use this package to do word autocompleting from all active views. I tunned it based on the https://github.com/alienhard/SublimeAllAutocomplete package.
0 Likes