Restart your VS Code Window or a Language Server

avatar
Borislav Hadzhiev

Last updated: Apr 6, 2024
4 min

banner

# Table of Contents

  1. How to restart your VS Code Window
  2. Setting a keyboard shortcut for the Reload Window action
  3. Restarting your VS Code window with an extension
  4. Restart the TypeScript server in VS Code
  5. Restart a Language Server in VS Code

# How to restart your VS Code Window

There are multiple ways to restart your VS Code Window.

One way is using the Command Palette:

  1. Press:
  • Ctrl + Shift + P on Windows and Linux
  • Command + Shift + P on macOS
Note: you can also press F1 to open the Command Palette.
  1. Type Reload Window and select Developer: Reload Window.

developer reload window

Here is a quick GIF that demonstrates the process.

reload window

You can also open the Command Palette by:

  1. Clicking on View -> Command Palette in the top menu bar.
Note that you might have to press Alt to show the top menu bar on Windows and Linux.

view command palette

Once you open the command palette, type Reload Window and select Developer: Reload Window.

developer reload window

# Setting a keyboard shortcut for the Reload Window action

The name of the action is called "workbench.action.reloadWindow".

To set a keyboard shortcut for the action:

  1. Press:
  • Ctrl + Shift + P on Windows and Linux.
  • Command + Shift + P on macOS.
Note: you can also press F1 to open the Command Palette.
  1. Type Keyboard Shortcuts and select Preferences: Open Keyboard Shortcuts.

preferences open keyboard shortcuts

  1. Click on the Open Keyboard Shortcuts (JSON) icon to the left.

open keyboard shortcuts

  1. Add the following object to your keybindings.json file.
keybindings.json
[ { "key": "ctrl+f5", "command": "workbench.action.reloadWindow", "when": "editorTextFocus" } ]

You can also set the keybinding to "cmd+f5" if you are on macOS.

add window reload keyboard shortcut

Now you can reload your VS Code window by pressing Ctrl + f5 (or cmd + f5 if on macOS).

# Restarting your VS Code window with an extension

You can also restart your VS Code window by using an extension:

  1. Click on Extensions in the left sidebar.
  • You can also open the Extensions menu by pressing:
    • Ctrl + Shift + X on Windows or Linux.
    • Command + Shift + X on macOS.

vscode install reload extension

  1. Type Reload and install the extension by natqe.

Now you will get a Reload button in the bottom status bar.

vscode reload window

  1. Clicking on the button restarts VS Code.

restart vscode using extension

# Restart the TypeScript server in VS Code

To restart your TypeScript server:

  1. Open a file that has a .js, .ts or .tsx extension.

  2. Press:

  • Ctrl + Shift + P on Windows and Linux.
  • Command + Shift + P on macOS.
Note: you can also press F1 to open the Command Palette.
  1. Type Restart and select TypeScript: Restart TS Server.

restart ts server

Note that you have to open a .ts or .tsx file for the option to show.

Make sure you haven't opened a Git diff instead of a TypeScript file.

If you have issues with your TypeScript server in VS Code, make sure you haven't disabled the TypeScript and JavaScript Language Features built-in extension by mistake.

  1. Click on Extensions in the left sidebar.
  • You can also open the Extensions menu by pressing:
    • Ctrl + Shift + X on Windows or Linux.
    • Command + Shift + X on macOS.
  1. Type @builtin typescript and make sure the TypeScript and JavaScript Language Features extension is enabled.

make sure typescript server enabled

The TypeScript and JavaScript Language Features built-in extension must be enabled for your TypeScript server to work as expected.

# Restart a Language Server in VS Code

The same approach can be used to restart a language server.

However, one thing you should note is that you need to open a file that is written in the language for the option to show.

For example, if you need to restart the Python server, you have to open a file with a .py extension.

Let's look at an example of restarting the Python language server in VS Code.

  1. Open a file that has a .py extension.

  2. Press:

  • Ctrl + Shift + P on Windows and Linux.
  • Command + Shift + P on macOS.
Note: you can also press F1 to open the Command Palette.
  1. Type Restart and select Python: Restart Language Server.

restart language server

When you have issues with a language server in VS Code, always check that you haven't disabled the built-in extensions for the language by mistake.

  1. Click on Extensions in the left sidebar.
  • You can also open the Extensions menu by pressing:
    • Ctrl + Shift + X on Windows or Linux
    • Command + Shift + X on macOS
  1. Type @builtin and make sure the extension for the language is enabled.

make sure built in extension enabled

The built-in extension must be enabled for your language server to work as expected.

You can open the command palette and type Restart to view all the servers that you are able to restart directly in VS Code.

  1. Press:
  • Ctrl + Shift + P on Windows and Linux.
  • Command + Shift + P on macOS.
  1. Type Restart and select the server you want to restart.

type restart and select server

I've also written an article on how to clear the Cache in VS Code.

# Additional Resources

You can learn more about the related topics by checking out the following tutorials:

I wrote a book in which I share everything I know about how to become a better, more efficient programmer.
book cover
You can use the search field on my Home Page to filter through all of my articles.