Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Visual Studio Setup

  • 16-10-2020 5:23pm
    #1
    Registered Users, Registered Users 2 Posts: 8,595 ✭✭✭


    Hello,

    I've started on a new project and I've been asked to use Visual Studio for development.

    Seems like a silly question (hence why I'm not asking any of the team members), but I've downloaded the shortcuts for VS and most of them do not work. Simple =things like Ctrl-C will remove the line.

    If I enter Ctrl+ (User Settings) or Ctrl+K Ctrl +X (trim trailing whitespace) nothing happens, apart from a popup informing me "Unable to write into user settings. Please open the user settings to correct errors/warnings in it and try again."


    In the user setting there is the following:
    {
        "python.pythonPath": "C:\\path\python.exe",
        "editor.renderWhitespace": "all"
    }{
        "workbench.colorTheme": "Solarize Light",
        "telemetry.enableCrashReporter": false,
        "telemetry.enableTelemetry": false.
    }
    


    Where "}{" is located there is an error:
    [jsonc] End of file expected [0].
    

    Having not using JSON before I'm not sure what is the problem. I've tried to add a comma after "all" but that does nothing. Also tried removing the last parenthesis and its contents with no success either.


Comments

  • Closed Accounts Posts: 711 ✭✭✭Three More Big Sleeps


    Is that the settings.json in its entirety, FM?

    If so, it's not valid: a JSON object can only have one root element (you've multiple - two :) - root elements here.)

    Just remove the middle closing- and opening-braces (#4).


  • Closed Accounts Posts: 711 ✭✭✭Three More Big Sleeps


    This is a handy site for validating json. It has more concise error reporting than VS's rather vague EOF error.

    https://jsonformatter.curiousconcept.com


  • Registered Users, Registered Users 2 Posts: 8,595 ✭✭✭funkey_monkey


    Thanks - got that working and then mucked up the view!

    How do I activate editor.action.trimTrailingWhitespace?
    I can only get files.trimTrailingWhitespace to activate, but that auto trims when saving. I don't want that - I just want it to update on my command.
    It would seem that the former is what I need, but it doesn't appear to be doing anything. There are restrictions on it - file must be in edit mode and should have text focus too, but I have that.


  • Closed Accounts Posts: 711 ✭✭✭Three More Big Sleeps


    Oh, boy, flying blind here and from memory.

    Assuming Windows, your User configuration json file should be here:

    %APPDATA%\Code\User\settings.json

    In addition to your settings in the OP, it should include this:
    {
       // Other setting pairs
    
       "editor.action.trimTrailingWhitespace" : true
    }
    

    Assuming the keystroke chord (Ctrl+K Ctrl+X) doesn't work for trimming trailing whitespace, then it might be:

    Keybinding Broken

    Have a looksee for the keybindings.json file (File -> Preferences -> Keyboard shortcuts) and ensure it contains the following:
    { "key": "ctrl+k ctrl+x", "command": "editor.action.trimTrailingWhitespace" }
    

    Settings Override

    There are three (or four if you include the default) levels of settings which will override the previous level:

    1. User settings (which you have set and override the defaults)
    2. Workspace settings (which override User settings)
    3. Folder settings (which override Workspace settings)

    Ensure that your User settings are not being reset in this instance. If it were me, I'd try a *.* find-in-files for "trimTrailingWhitespace" as a starting point.

    See this link for more info on the settings hierarchy -> https://code.visualstudio.com/docs/getstarted/settings

    I hope this helps, and I apologise in advance for the vagueness :) If I think of anything else, I'll come back to you.


  • Closed Accounts Posts: 711 ✭✭✭Three More Big Sleeps


    Any joy, FM?


  • Advertisement
  • Registered Users, Registered Users 2 Posts: 8,595 ✭✭✭funkey_monkey


    Hi - sorry!
    Yes - all sorted. JSON was sorted by your first response.
    Zoom in: ctrl + =
    Zoom out: ctrl + numpad-

    Still feeling my way around. It was a shame that the Visual Studio keyboard shortcuts I downloaded didn't specify that zoom out was numpad -. I never though of that until I read it somewhere online.

    trim trailing whitespace is ctrl numpad decimal. Not sure where they got that from, but that is what it is.

    So, thanks for the help - it was much appreciated. Still feeling my way around the IDE, but a bit happier with it now. Was a bit panicked when it zoomed all the way in and I could not zoom out!


  • Registered Users, Registered Users 2 Posts: 10,912 ✭✭✭✭28064212


    For your own benefit: Visual Studio and Visual Studio Code are not the same thing. You should be clear about which one you're using, because otherwise you'll have a nightmare trying to find any assistance

    Boardsie Enhancement Suite - a browser extension to make using Boards on desktop a better experience (includes full-width display, keyboard shortcuts, dark mode, and more). Now available through your browser's extension store.

    Firefox: https://addons.mozilla.org/addon/boardsie-enhancement-suite/

    Chrome/Edge/Opera: https://chromewebstore.google.com/detail/boardsie-enhancement-suit/bbgnmnfagihoohjkofdnofcfmkpdmmce



  • Closed Accounts Posts: 711 ✭✭✭Three More Big Sleeps


    Glad you got sorted, FM :)
    28064212 wrote: »
    ... Visual Studio and Visual Studio Code are not the same thing...

    A fair point alright, 28064212, though, imo, any blame should be attributed to MS for naming a glorified text editor after their premium IDE.


Advertisement