ycmd
                                
                                 ycmd copied to clipboard
                                
                                    ycmd copied to clipboard
                            
                            
                            
                        Try to infer the latest MSVC version on windows like CMake Does
- Remove --msvc arg on other platforms than windows
- Default the value of msvc to the latest found
eg, trying it on on one of my windows VMs that has MSVC 2022 (=17)
  --msvc {15,16,17}     Choose the Microsoft Visual Studio version (default: 17).
@MergifyIO rebase
rebase
✅ Branch has been successfully rebased
ci is failing
CI is failing because of styling issues. My entire vim setup is configured to follow PEP 8 and this styling is highly unusual. I'm going to take https://github.com/micbou/flake8-ycm for a spin and try to fix it.
The python style is not PEP8 by choice: from CONTRIBUTING.md.

This predates my involvement, but I stand by the choice; Val's style is much more readable (to me) than PEP8 would be. As you noticed we even have a flake8 plugin that will validate our style. I appreciate if you're used to another style, it's jarring though :D
/home/runner/work/ycmd/ycmd/build.py:1:15: E999 SyntaxError: invalid syntax
BTW you can run the check locally with something like:
$ python3 -m venv test-env
$ source test-env/bin/activate
$ pip install -r test_requirements.txt
$ ./run_tests --skip-build
This will run flake8 first (then run the tests, but you can ctrl-c them if you want). or you can just run flake8 *.py ycmd/
/home/runner/work/ycmd/ycmd/build.py:1:15: E999 SyntaxError: invalid syntax
Which runner is spitting this? I'm not seeing it locally... That's the shebang line too...
/home/runner/work/ycmd/ycmd/build.py:1:15: E999 SyntaxError: invalid syntax
Which runner is spitting this? I'm not seeing it locally... That's the shebang line too...
Ugh, that's... omfg. I've approved the run again; fingers crossed.
Sometimes upstream changes in things like flake8 just break....
seeing this:
Run python3 benchmark.py --quiet
  File "<fstring>", line 1
    (latest_full_v=)
                  ^
SyntaxError: invalid syntax
Argh wth....
seeing this:
Run python3 benchmark.py --quiet File "<fstring>", line 1 (latest_full_v=) ^ SyntaxError: invalid syntax
https://github.com/ycm-core/ycmd/pull/1626/commits/3fae6955455abe0f43452c56e6fe0b092ede368f should fix it. Same issue, can't pass --msvc if not on windows anymore.
I have Ubuntu 20.04, locally with https://github.com/ycm-core/ycmd/commit/3fae6955455abe0f43452c56e6fe0b092ede368f I can run benchmark.py just fine, despite what GHA is saying in https://github.com/ycm-core/ycmd/runs/7956426099?check_suite_focus=true ... I'm confused.
Click to expand local logs
(ycmd)julien@ycmd (infer_msvc_version=)$ python benchmark.py
Generating ycmd build configuration...OK
Compiling ycmd target: ycm_core...OK
Compiling ycmd target: ycm_core_benchmarks...OK
2022-08-22T18:21:04+02:00
Running /tmp/ycm_build_n95c1tq3/ycm/benchmarks/ycm_core_benchmarks
Run on (16 X 3600 MHz CPU s)
CPU Caches:
  L1 Data 32 KiB (x8)
  L1 Instruction 64 KiB (x8)
  L2 Unified 512 KiB (x8)
  L3 Unified 8192 KiB (x2)
Load Average: 5.90, 11.72, 12.25
------------------------------------------------------------------------------------------------------------------------
Benchmark                                                                              Time             CPU   Iterations
------------------------------------------------------------------------------------------------------------------------
IdentifierCompleterFixture/CandidatesWithCommonPrefix/1/0                            598 ns          598 ns      1171383
IdentifierCompleterFixture/CandidatesWithCommonPrefix/16/0                          4259 ns         4257 ns       162846
IdentifierCompleterFixture/CandidatesWithCommonPrefix/256/0                        74652 ns        74623 ns         9533
IdentifierCompleterFixture/CandidatesWithCommonPrefix/4096/0                     1146614 ns      1146068 ns          609
IdentifierCompleterFixture/CandidatesWithCommonPrefix/65536/0                   24265345 ns     24247165 ns           28
IdentifierCompleterFixture/CandidatesWithCommonPrefix_BigO                         23.14 NlgN      23.12 NlgN 
IdentifierCompleterFixture/CandidatesWithCommonPrefix_RMS                              0 %             0 %    
IdentifierCompleterFixture/CandidatesWithCommonPrefix/1/10                           573 ns          573 ns      1213145
IdentifierCompleterFixture/CandidatesWithCommonPrefix/16/10                         3544 ns         3543 ns       198360
IdentifierCompleterFixture/CandidatesWithCommonPrefix/256/10                       40361 ns        40350 ns        17149
IdentifierCompleterFixture/CandidatesWithCommonPrefix/4096/10                     644327 ns       643997 ns         1075
IdentifierCompleterFixture/CandidatesWithCommonPrefix/65536/10                  12764358 ns     12751933 ns           56
IdentifierCompleterFixture/CandidatesWithCommonPrefix_BigO                         12.18 NlgN      12.16 NlgN 
IdentifierCompleterFixture/CandidatesWithCommonPrefix_RMS                              1 %             1 %    
PythonSupportFixture/FilterAndSortUnstoredCandidatesWithCommonPrefix/1/0            2475 ns         2491 ns       280983
PythonSupportFixture/FilterAndSortUnstoredCandidatesWithCommonPrefix/16/0          22939 ns        22975 ns        30796
PythonSupportFixture/FilterAndSortUnstoredCandidatesWithCommonPrefix/256/0        356515 ns       356393 ns         2043
PythonSupportFixture/FilterAndSortUnstoredCandidatesWithCommonPrefix/4096/0      5477176 ns      5473803 ns          129
PythonSupportFixture/FilterAndSortUnstoredCandidatesWithCommonPrefix/65536/0    95884014 ns     95824835 ns            7
PythonSupportFixture/FilterAndSortUnstoredCandidatesWithCommonPrefix_BigO        1462.58 N       1461.68 N    
PythonSupportFixture/FilterAndSortUnstoredCandidatesWithCommonPrefix_RMS               1 %             1 %    
PythonSupportFixture/FilterAndSortUnstoredCandidatesWithCommonPrefix/1/50           2494 ns         2513 ns       267024
PythonSupportFixture/FilterAndSortUnstoredCandidatesWithCommonPrefix/16/50         22811 ns        22846 ns        30574
PythonSupportFixture/FilterAndSortUnstoredCandidatesWithCommonPrefix/256/50       319981 ns       319819 ns         2193
PythonSupportFixture/FilterAndSortUnstoredCandidatesWithCommonPrefix/4096/50     4841900 ns      4839726 ns          133
PythonSupportFixture/FilterAndSortUnstoredCandidatesWithCommonPrefix/65536/50   82063849 ns     82007316 ns            8
PythonSupportFixture/FilterAndSortUnstoredCandidatesWithCommonPrefix_BigO        1251.92 N       1251.06 N    
PythonSupportFixture/FilterAndSortUnstoredCandidatesWithCommonPrefix_RMS               1 %             1 %    
PythonSupportFixture/FilterAndSortStoredCandidatesWithCommonPrefix/1/0               781 ns          781 ns       905121
PythonSupportFixture/FilterAndSortStoredCandidatesWithCommonPrefix/16/0             4741 ns         4739 ns       148847
PythonSupportFixture/FilterAndSortStoredCandidatesWithCommonPrefix/256/0           82211 ns        82175 ns         8528
PythonSupportFixture/FilterAndSortStoredCandidatesWithCommonPrefix/4096/0        1262645 ns      1261902 ns          550
PythonSupportFixture/FilterAndSortStoredCandidatesWithCommonPrefix/65536/0      29401018 ns     29379464 ns           24
PythonSupportFixture/FilterAndSortStoredCandidatesWithCommonPrefix_BigO            28.03 NlgN      28.01 NlgN 
PythonSupportFixture/FilterAndSortStoredCandidatesWithCommonPrefix_RMS                 1 %             1 %    
PythonSupportFixture/FilterAndSortStoredCandidatesWithCommonPrefix/1/50              773 ns          772 ns       892480
PythonSupportFixture/FilterAndSortStoredCandidatesWithCommonPrefix/16/50            5448 ns         5445 ns       118726
PythonSupportFixture/FilterAndSortStoredCandidatesWithCommonPrefix/256/50          54031 ns        54005 ns        12884
PythonSupportFixture/FilterAndSortStoredCandidatesWithCommonPrefix/4096/50        811025 ns       810458 ns          859
PythonSupportFixture/FilterAndSortStoredCandidatesWithCommonPrefix/65536/50     16211577 ns     16194563 ns           44
PythonSupportFixture/FilterAndSortStoredCandidatesWithCommonPrefix_BigO            15.46 NlgN      15.45 NlgN 
PythonSupportFixture/FilterAndSortStoredCandidatesWithCommonPrefix_RMS                 1 %             1 %    
Building regex module...OK
Building watchdog module...OK
I can't repro locally either, but I ran CI against master to check if it was a CI env issue, and that was OK. so something about this patch is tripping up flake8 in GHA.. but only on linux/Mac...
OK I can repro locally with python 3.6.15 using pyenv.
ben@BeniMac2020 ycmd % ./run_tests.py
Running tests on Python 3.6.15
> [email protected] postinstall
> cd client && npm install && cd ../server && npm install && cd ..
up to date, audited 27 packages in 415ms
found 0 vulnerabilities
up to date, audited 6 packages in 410ms
found 0 vulnerabilities
up to date, audited 218 packages in 2s
30 packages are looking for funding
  run `npm fund` for details
4 vulnerabilities (2 moderate, 1 high, 1 critical)
To address all issues, run:
  npm audit fix
Run `npm audit` for details.
> [email protected] compile
> tsc -b
Running flake8
/Users/ben/.vim/bundle/YouCompleteMe/third_party/ycmd/build.py:1:15: E999 SyntaxError: invalid syntax
Traceback (most recent call last):
  File "./run_tests.py", line 390, in <module>
    Main()
  File "./run_tests.py", line 381, in Main
    RunFlake8()
  File "./run_tests.py", line 57, in RunFlake8
    subprocess.check_call( args )
  File "/Users/ben/.pyenv/versions/3.6.15/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/subprocess.py", line 311, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['/Users/ben/.pyenv/versions/3.6.15/Library/Frameworks/Python.framework/Versions/3.6/bin/python3', '-m', 'flake8', '/Users/ben/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd', '/Users/ben/.vim/bundle/YouCompleteMe/third_party/ycmd/build.py', '/Users/ben/.vim/bundle/YouCompleteMe/third_party/ycmd/update_unicode.py', '/Users/ben/.vim/bundle/YouCompleteMe/third_party/ycmd/update_clang_headers.py', '/Users/ben/.vim/bundle/YouCompleteMe/third_party/ycmd/benchmark.py', '/Users/ben/.vim/bundle/YouCompleteMe/third_party/ycmd/run_tests.py', '/Users/ben/.vim/bundle/YouCompleteMe/third_party/ycmd/update_omnisharp.py', '/Users/ben/.vim/bundle/YouCompleteMe/third_party/ycmd/update_api_docs.py']' returned non-zero exit status 1.
ben@BeniMac2020 ycmd %
what the actual...
ben@BeniMac2020 ycmd % python -m flake8 ycmd/ *.py
build.py:1:15: E999 SyntaxError: invalid syntax
ben@BeniMac2020 ycmd % python -m flake8 *.py
build.py:1:15: E999 SyntaxError: invalid syntax
ben@BeniMac2020 ycmd % python -m flake8 build.py
build.py:1:15: E999 SyntaxError: invalid syntax
ben@BeniMac2020 ycmd % which flake8
/Users/ben/Library/Python/3.9/bin/flake8
ben@BeniMac2020 ycmd % flake8 build.py
ben@BeniMac2020 ycmd % python -m flake8 build.py
build.py:1:15: E999 SyntaxError: invalid syntax
ben@BeniMac2020 ycmd %
this fixes is:
       except ValueError:
-        raise ValueError( "{latest_full_v=} is not a version number." )
+        raise ValueError( f"{latest_full_v} is not a version number." )
       if not quiet:
-        print( f'vswhere -latest returned version {latest_full_v=}' )
+        print( f'vswhere -latest returned version {latest_full_v}' )
       if latest_v not in ACCEPTABLE_VERSIONS:
         if latest_v > 17:
           if not quiet:
-            print( f'MSVC Version {latest_full_v=} is newer than expected.' )
+            print( f'MSVC Version {latest_full_v} is newer than expected.' )
         else:
           raise ValueError(
-            f'vswhere returned {latest_full_v=} which is unexpected.'
+            f'vswhere returned {latest_full_v} which is unexpected.'
             'Pass --msvc <version> argument.' )
       return latest_v
     else:
       if not quiet:
-        print( f'vswhere returned nothing usable, {latest_full_v=}' )
+        print( f'vswhere returned nothing usable, {latest_full_v}' )
Not sure what the = suffix does on the f-string, but python 3.6.15 doesn' support it so we can't use it.
@puremourning this is embarassing since this is actually the second time I get bit by partial f-string support in earlier python 3.x. the "=" one was added in 3.8: https://docs.python.org/3/whatsnew/3.8.html#f-strings-support-for-self-documenting-expressions-and-debugging
f"{var=}" is equivalent to f"var={var}"
Thanks a lot for the bug hunting and fixing.
Codecov Report
Merging #1626 (d833b0e) into master (81759a5) will increase coverage by
0.01%. The diff coverage isn/a.
@@            Coverage Diff             @@
##           master    #1626      +/-   ##
==========================================
+ Coverage   95.42%   95.43%   +0.01%     
==========================================
  Files          90       90              
  Lines        8157     8157              
  Branches      164      164              
==========================================
+ Hits         7784     7785       +1     
+ Misses        321      320       -1     
  Partials       52       52              
Thanks for sending a PR!