File: 04-do-not-require-semantic-highlighting.patch

package info (click to toggle)
vim-youcompleteme 0%2B20240827%2Bgitb6e8c64%2Bds-4
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 3,436 kB
  • sloc: python: 10,914; sh: 204; cpp: 141; makefile: 26; f90: 5; xml: 1
file content (50 lines) | stat: -rw-r--r-- 1,559 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
Description: Do not require a ycmd upgrade
 No need to entangle us too strongly for experimental features
Author: David Kalnischkies <donkult@debian.org>
Forwarded: not-needed

--- a/autoload/youcompleteme.vim
+++ b/autoload/youcompleteme.vim
@@ -183,8 +183,14 @@
 
   call s:SetUpOptions()
 
-  py3 ycm_semantic_highlighting.Initialise()
-  let s:enable_inlay_hints = py3eval( 'ycm_inlay_hints.Initialise()' ) ? 1 : 0
+  if get( g:, 'ycm_enable_semantic_highlighting', 1 )
+    py3 ycm_semantic_highlighting.Initialise()
+  endif
+  if get( g:, 'ycm_enable_inlay_hints', 0 )
+    let s:enable_inlay_hints = py3eval( 'ycm_inlay_hints.Initialise()' ) ? 1 : 0
+  else
+    let s:enable_inlay_hints = 0
+  endif
 
   call youcompleteme#EnableCursorMovedAutocommands()
   augroup youcompleteme
@@ -278,8 +284,6 @@
 try:
   # Import the modules used in this file.
   from ycm import base, vimsupport, youcompleteme
-  from ycm import semantic_highlighting as ycm_semantic_highlighting
-  from ycm import inlay_hints as ycm_inlay_hints
 
   if 'ycm_state' in globals():
     # If re-initializing, pretend that we shut down
@@ -316,6 +320,16 @@
   vim.command( 'echohl None' )
   vim.command( 'return 0' )
 else:
+  try:
+    from ycm import semantic_highlighting as ycm_semantic_highlighting
+  except Exception:
+    vim.command( 'let g:ycm_enable_semantic_highlighting = 0' )
+
+  try:
+    from ycm import inlay_hints as ycm_inlay_hints
+  except Exception:
+    vim.command( 'let g:ycm_enable_inlay_hints = 0' )
+
   vim.command( 'return 1' )
 EOF
 endfunction