ycm-core / ycmd

A code-completion & code-comprehension server
https://ycm-core.github.io/ycmd/
GNU General Public License v3.0
1.69k stars 764 forks source link

Uninstall default bottle plugins #1734

Closed bstaletic closed 7 months ago

bstaletic commented 7 months ago

By default, bottle installs two plugins: JSONPlugin and TemplatePlugin.

TemplatePlugin is always a no-op, because none of the routes we use (like /ready) have a template parameter.

JSONPlugin could have been useful were it actually serializing all json messages. Instead it only deals with dictionaries. Ycmd has always had ycmd.handlers._JsonResponse and we will need to keep it that way. _JsonResponse makes JSONPlugin a no-op too, because, by the time we get to the JSONPlugin.apply() the response is always a str already.

Bottle.uninstall() can be passed:

  1. An instance of an installed plugins, to uninstall that one plugin.
  2. A type, to uninstall all plugins of that type.
  3. True, to uninstall all plugins.

Since we are uninstalling all default plugins, we can just do handlers.app.uninstall( True ) and then install the plugins we care about - ycmd.HmacPlugin and ycmd.WatchdogPlugin.


This change is Reviewable

codecov[bot] commented 7 months ago

Codecov Report

Merging #1734 (e6b3a56) into master (b8957d7) will increase coverage by 0.00%. The diff coverage is 100.00%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #1734 +/- ## ======================================= Coverage 95.44% 95.44% ======================================= Files 83 83 Lines 8166 8167 +1 Branches 163 163 ======================================= + Hits 7794 7795 +1 Misses 322 322 Partials 50 50 ```
mergify[bot] commented 7 months ago

Thanks for sending a PR!