Repository navigation
CppAssistant 2.2.0
2.2.0 is the "make the popup tell you more, and stop making you retype things"
release. Competitive-programming specifics that were easy to forget are now
automatic: PBDS headers are inserted for you, auto variables show their real
type, bits/stdc++.h is explained instead of silently ignored, and one
keystroke fixes full-width punctuation. It also adds the navigation and
template workflow commands: call/type hierarchy, a template browser with
inline preview, snippet management, grouped references and status-bar hints.
Features
- PBDS header insertion: completing
__gnu_pbds::tree,
gp_hash_tableororder_of_keyinserts
#include <ext/pb_ds/assoc_container.hpp>and
#include <ext/pb_ds/tree_policy.hpp>automatically.bits/stdc++.h
does not cover PBDS, so these two headers are still inserted when
the universal header is present. New setting:
cpp_auto_insert_pbds_includes(defaulttrue). After the insertion
clangd re-syncs the document immediately, so the next completion is
already based on the new include. __gnu_pbds::namespace completion:tree,gp_hash_table,
cc_hash_table,rb_tree_tag,splay_tree_tag,ov_tree_tag,
tree_order_statistics_node_update,null_typeand the resize
policies, with the full template skeleton in the insert text.- C++20 subset:
std::rangesalgorithms,std::viewsadaptors and
commonstd::conceptsare in the database, taggedC++20. Typing
ranges::orviews::lists only that sub-namespace and drops the
prefix, sostd::ranges::scompletes tosort, not tostd::ranges::sort
inside an already-qualified name. - Template browser with preview:
CppAssistant: Browse Templates
shows every installed snippet in a quick panel with a preview of the
first 20 lines, its origin and its line count; selecting an entry
inserts it as a real snippet ($0/${1:default}tab stops work). - Snippet management:
CppAssistant: Manage User Snippetslists user
and template-pack snippets with open / rename-trigger / move-to-trash
actions. Trashed files go toPackages/User/CppAssistantSnippetTrash
with a.offextension, so they stop appearing in completion but can
be restored. - Full-width punctuation fix:
CppAssistant: Fix Full-width Punctuation(Ctrl+Alt+,) replaces,;:()and friends with their
half-width forms only in code — comments, string/char literals and
raw strings keep their Chinese punctuation. Works on the selection when
one exists, asks for confirmation, and reports how many characters it
changed. - Call / type hierarchy:
CppAssistant: Call Hierarchyasks clangd
for incoming and outgoing calls of the function under the cursor;
CppAssistant: Type Hierarchylists base classes (supertypes) and
derived classes (subtypes). Both open the result in a quick panel and
jump on selection. - Status bar hints (
show_status_hint, defaulttrue): shows the
active completion source and the call under the cursor, including which
argument is being typed, e.g.
[clangd] · void solve(int n, vector<int>& a) · arg 2/2: vector<int>& a.
A lightweight stand-in for CodeLens. - Settings validation:
CppAssistant: Validate Settings(also run at
startup) reports values Sublime would silently ignore, such as
cxx_standard: "c++2x",lint_timeout: 0or
include_paths: "D:/inc", in the console, the status bar and an output
panel. - Grouped find references: results are sorted by file, numbered
[3/7]per file, and keep the inline preview line.
Completion display
- Local variables, parameters, functions, structs, enums, macros and
aliases now carry concrete details in the builtin fallback:
totalbecomesint,addbecomesint add(int x, int y), and
parameters are labelledparameter. - Completion ranking prefers local symbols first, then user-defined
functions and types, then the STL database, then keywords. - STL and
__gnu_pbdsmember signatures now show complexity hints such as
push_back(int) · O(1),find(const long long&) · O(log n), and
insert(...) · O(1) avgfor hash tables. - User snippets and installed template packs are annotated with their
origin, for examplekmp · 字符串模板/kmp · Strings template,
so the popup no longer hides where an entry came from. - Macros use their own kind (
macro, variable icon) instead of being
grouped with functions, and#includecompletions explain what the
header contains (bits/stdc++.h→ all standard headers, not PBDS). autovariables are inferred at completion time:auto it = v.find(x)
showsvector<int>::iterator,auto value = m.at("k")showsint.- Duplicate triggers inside one container (for example
stringstream,
which inherits both stream directions) no longer appear twice. std::ranges/std::views/std::conceptsentries are tagged
C++20, so they rank after the C++14 database until the standard is
raised.
Removed
- The bundled
Basictemplate pack (us,inc,fastio,mainf,
solvef,pii) is gone; the plugin now ships Geometry, Graph, DS,
Strings and Math packs only.
Tests and packaging
- Test suite grows from 134 to 208 cases: full-width fixer, settings
validation, call context, PBDS/ranges data, completion-database
integrity (duplicate triggers, missing English details), package
integrity (commands / menu / keymap / messages must match the classes
that exist) and an import smoke test that loads the whole plugin against
a stubbedsublimemodule. - New modules:
cppassistant/ca_fixes.py(punctuation scanner/rewriter)
andcppassistant/ca_config.py(settings schema validation). Both are
pure Python and unit-tested without Sublime Text.
Install
- Package Control:
Ctrl+Shift+P-> Package Control: Install Package -> CppAssistant - Manual: download
CppAssistant.sublime-packagebelow, put it inPackages/(orInstalled Packages/), restart Sublime Text. - Git:
git clone https://github.com/chenmoulaile/Sublime-CppAssistant CppAssistantinto yourPackagesdirectory.
Requires Sublime Text 4 (build 4000+). clangd, g++/clang++, libclang and clang-format are optional: without them the built-in engine still gives completion, F12 and instant checks.
Full changelog: https://github.com/chenmoulaile/Sublime-CppAssistant/blob/main/CHANGELOG.md
Compare: v2.1.1...v2.2.0