<commit_before>let s:save_cpo = &cpoptions
set cpoptions&vim

let s:nextseq = get(s:, 'nextseq', 1001)
let s:requests = get(s:, 'requests', {})
let s:pendingRequests = get(s:, 'pendingRequests', {})

function! s:HandleServerEvent(job, res) abort
  if has_key(a:res, 'Body') && type(a:res.Body) == type({})
    if !a:job.loaded

      " Listen for server-loaded events
      "-------------------------------------------------------------------------
      if g:OmniSharp_server_stdio_quickload
        " Quick load: Mark server as loaded as soon as configuration is finished
        let message = get(a:res.Body, 'Message', '')
        if message ==# 'Configuration finished.'
          let a:job.loaded = 1
          silent doautocmd <nomodeline> User OmniSharpReady
          call s:ReplayRequests()
        endif
      else
        " Complete load: Wait for all projects to be loaded before marking
        " server as loaded
        if !has_key(a:job, 'loading_timeout')
          " Create a timeout to mark a job as loaded after 30 seconds despite
          " not receiving the expected server events.
          let a:job.loading_timeout = timer_start(
          \ g:OmniSharp_server_loading_timeout * 1000,
          \ function('s:ServerLoadTimeout', [a:job]))
        endif
        if !has_key(a:job, 'loading')
          let a:job.loading = []
        endif
        let name = get(a:res.Body, 'Name', '')
        let message = get(a:res.Body, 'Message', '')
        if name ==# 'OmniSharp.MSBuild.ProjectManager'
          let project = matchstr(message, '''\zs.*\ze''')
          if message =~# '^Queue project'
            call add(a:job.loading, project)
          endif
          if message =~# '^Successfully loaded project' || message =~# '^Failed to load project'
            call filter(a:job.loading, {idx,val -> val !=# project})
            if len(a:job.loading) == 0
              if g:OmniSharp_server_display_loading<commit_msg>Tell user about projects that failed to load<commit_after>let s:save_cpo = &cpoptions
set cpoptions&vim

let s:nextseq = get(s:, 'nextseq', 1001)
let s:requests = get(s:, 'requests', {})
let s:pendingRequests = get(s:, 'pendingRequests', {})

function! s:HandleServerEvent(job, res) abort
  if has_key(a:res, 'Body') && type(a:res.Body) == type({})
    if !a:job.loaded

      " Listen for server-loaded events
      "-------------------------------------------------------------------------
      if g:OmniSharp_server_stdio_quickload
        " Quick load: Mark server as loaded as soon as configuration is finished
        let message = get(a:res.Body, 'Message', '')
        if message ==# 'Configuration finished.'
          let a:job.loaded = 1
          silent doautocmd <nomodeline> User OmniSharpReady
          call s:ReplayRequests()
        endif
      else
        " Complete load: Wait for all projects to be loaded before marking
        " server as loaded
        if !has_key(a:job, 'loading_timeout')
          " Create a timeout to mark a job as loaded after 30 seconds despite
          " not receiving the expected server events.
          let a:job.loading_timeout = timer_start(
          \ g:OmniSharp_server_loading_timeout * 1000,
          \ function('s:ServerLoadTimeout', [a:job]))
        endif
        if !has_key(a:job, 'loading')
          let a:job.loading = []
        endif
        let name = get(a:res.Body, 'Name', '')
        let message = get(a:res.Body, 'Message', '')
        if name ==# 'OmniSharp.MSBuild.ProjectManager'
          let project = matchstr(message, '''\zs.*\ze''')
          if message =~# '^Queue project'
            call add(a:job.loading, project)
          endif
          if message =~# '^Successfully loaded project' || message =~# '^Failed to load project'
            if message[0] == 'F'
              echom 'Failed to load project: ' . project
            endif
            call filter(a:job.loading, {idx,val -> val !=# project})
            if len(a:job.loading) == 0
              if g:OmniSharp_server_display_loading
{'fraction_non_alphanumeric': 0.15110230369085956, 'fraction_numerical': 0.00619271736437949, 'mean_word_length': 2.15962441314554, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2333427', 'n_tokens_mistral': 1193, 'n_tokens_neox': 1156, 'n_words': 336}