Repository: holoviz/holoviews

Issue:
Example of PointerX in documentation does not work in vscode
Thanks for contacting us! Please read and follow these instructions carefully, then delete this introductory text to keep your issue easy to read. Note that the issue tracker is NOT the place for usage questions and technical assistance; post those at [Discourse](https://discourse.holoviz.org) instead. Issues without the required information below may be closed immediately.



#### ALL software version info
(this library, plus any other relevant software, e.g. bokeh, python, notebook, OS, browser, etc)
holoviews            1.15.4
hvplot               0.8.2
jupyter-bokeh        3.0.5
jupyter_client       8.0.3
jupyter_core         5.2.0
jupyterlab-widgets   3.0.5

Version: 1.75.1 (system setup)
Commit: 441438abd1ac652551dbe4d408dfcec8a499b8bf
Date: 2023-02-08T21:32:34.589Z
Electron: 19.1.9
Chromium: 102.0.5005.194
Node.js: 16.14.2
V8: 10.2.154.23-electron.0
OS: Windows_NT x64 10.0.22621
Sandboxed: No

#### Description of expected behavior and the observed behavior
expect example code at (https://holoviews.org/reference/streams/bokeh/PointerX.html?highlight=pointerx)
to run in vscode without modification but didnt
however adding the following lines makes it work as expected so please add the following lines to the example .
Could be just comments in the example code for vscode users

import panel as pn
pn.extension(comms='vscode')

#### Complete, minimal, self-contained example code that reproduces the issue

```
# code goes here between backticks

```

#### Stack traceback and/or browser JavaScript console output

#### Screenshots or screencasts of the bug in action



Discussion:

Resolving patch:
diff --git a/holoviews/plotting/bokeh/callbacks.py b/holoviews/plotting/bokeh/callbacks.py
--- a/holoviews/plotting/bokeh/callbacks.py
+++ b/holoviews/plotting/bokeh/callbacks.py
@@ -102,7 +102,7 @@ class Callback:
     _transforms = []
 
     # Asyncio background task
-    _baskground_task = set()
+    _background_task = set()
 
     def __init__(self, plot, streams, source, **params):
         self.plot = plot
@@ -276,7 +276,7 @@ async def on_change(self, attr, old, new):
             self._set_busy(True)
             task = asyncio.create_task(self.process_on_change())
             self._background_task.add(task)
-            task.add_done_callback(self._baskground_task.discard)
+            task.add_done_callback(self._background_task.discard)
 
     async def on_event(self, event):
         """
@@ -289,7 +289,7 @@ async def on_event(self, event):
             self._set_busy(True)
             task = asyncio.create_task(self.process_on_event())
             self._background_task.add(task)
-            task.add_done_callback(self._baskground_task.discard)
+            task.add_done_callback(self._background_task.discard)
 
     async def process_on_event(self, timeout=None):
         """
@@ -317,7 +317,7 @@ async def process_on_event(self, timeout=None):
             self.on_msg(msg)
         task = asyncio.create_task(self.process_on_event())
         self._background_task.add(task)
-        task.add_done_callback(self._baskground_task.discard)
+        task.add_done_callback(self._background_task.discard)
 
     async def process_on_change(self):
         # Give on_change time to process new events
@@ -352,7 +352,7 @@ async def process_on_change(self):
             self._prev_msg = msg
         task = asyncio.create_task(self.process_on_change())
         self._background_task.add(task)
-        task.add_done_callback(self._baskground_task.discard)
+        task.add_done_callback(self._background_task.discard)
 
     def set_callback(self, handle):
         """
diff --git a/holoviews/util/__init__.py b/holoviews/util/__init__.py
--- a/holoviews/util/__init__.py
+++ b/holoviews/util/__init__.py
@@ -9,7 +9,7 @@
 from pathlib import Path
 
 import param
-
+import panel as pn
 from pyviz_comms import extension as _pyviz_extension
 
 from ..core import (
@@ -719,6 +719,18 @@ def __call__(self, *args, **params):
             raise ImportError('None of the backends could be imported')
         Store.set_current_backend(selected_backend)
 
+        if pn.config.comms == "default":
+            try:
+                import google.colab  # noqa
+                pn.config.comms = "colab"
+                return
+            except ImportError:
+                pass
+
+            if "VSCODE_PID" in os.environ:
+                pn.config.comms = "vscode"
+                return
+
     @classmethod
     def register_backend_callback(cls, backend, callback):
         """Registers a hook which is run when a backend is loaded"""


Test patch: