Блог пользователя DrSwad

Автор DrSwad, история, 3 года назад, По-английски

Demo

Hello Codeforces!

I used to code in Sublime Text before using the awesome FastOlympicCoding plugin by Jatana. It had a really cool feature that allowed me to autocomplete long and tedious class types based on just the initials, for example, typing mipii would result in map<int, pair<int, int>>.

But since switching to VSCode, I've been looking for such an extension with this functionality for very long. But I'm quite surprised to find none (given VSCode's rich extension culture).

So, I tried writing one on my own. I also added a few extra features, such as, variable number of parameters (for tuples) and putting numbers in template parameters (for arrays). Since the extension is completely new, I doubt you'll find it in the marketplace just by the name. But I was able to find it by searching drswad.vscode-cpp-class-completion. Or you can try the direct URL too I think.

The usage should be straight-forward, but you can view the details in the repository if you need to. You're welcome to give it a go and I'll be very happy to receive any feedback. Also, if you have found an issue or have any feature request, kindly open an issue in the repository. Pull requests are most welcome. Enjoy!

Important Note: In order make sure that the class completions are prioritized before all other suggestions, set the editor.snippetSuggestions to top in your editor's settings.json file.

  • Проголосовать: нравится
  • +38
  • Проголосовать: не нравится

»
3 года назад, # |
  Проголосовать: нравится +5 Проголосовать: не нравится

This extenstion is really useful, thanks DrSwad for this.

  • »
    »
    3 года назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    Most welcome :) Feel free to let me know if you have ideas for any cool features.

»
3 года назад, # |
  Проголосовать: нравится +5 Проголосовать: не нравится

Cool extension it will help a lot. Thanks for building it

»
3 года назад, # |
  Проголосовать: нравится +5 Проголосовать: не нравится

That's amazing.. thanks man.

»
3 года назад, # |
  Проголосовать: нравится +5 Проголосовать: не нравится

Most needed thanks a ton.

»
3 года назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

{
    "editor.snippetSuggestions": "top",
    "code-runner.runInTerminal": true,
    "code-runner.saveAllFilesBeforeRun": true,
    "code-runner.saveFileBeforeRun": true,
    "workbench.colorTheme": "Monokai",
    "window.zoomLevel": 1,
    "C_Cpp.errorSquiggles": "Enabled",
    "[json]": {
    
        "editor.quickSuggestions": {
            "strings": true
        },
        "editor.suggest.insertMode": "replace"
    }
}

I'm quite new to VS Code (and coding environments in general), but I can't get the extension to work. Attached above is my settings.json file; Have I configured everything correctly?

  • »
    »
    3 года назад, # ^ |
    Rev. 2   Проголосовать: нравится 0 Проголосовать: не нравится

    Yes, I think it should be enough to work. May I know your VSCode editor version please? I used the latest release (1.56) to develop, so the extension's minimum version requirement was set to 1.56 by default iirc. I can lower it to include your version.

    Update: Also, sometimes suggestions popup doesn't appear automatically and you need to actually press Ctrl+B to view the suggestions. Thought I should let you know for the sake of completeness.

    • »
      »
      »
      3 года назад, # ^ |
        Проголосовать: нравится 0 Проголосовать: не нравится

      My VSCode is the latest version, and the suggestions popups work as normal, but I still can't see the competitive programming class types. I'm on Mac, if that has any impact on performance.

      • »
        »
        »
        »
        3 года назад, # ^ |
          Проголосовать: нравится 0 Проголосовать: не нравится

        OS shouldn't be a problem (I developed it on Mac too).

        I'm really interested in debugging this issue. It might take a bit of your time too. If you're willing to see it through, then can you kindly open an issue in github (so that this thread doesn't keep popping up in CF recent actions)?

        The issue doesn't need to be long, just your VSCode version and your steps to reproduce the problem would be fine. But it's understandable too if you don't wish to go through the debug process.