changeset 11:096e80c13781

Use the correct documentation extension.
author Ludovic Chabant <ludovic@chabant.com>
date Fri, 22 Jan 2021 16:42:25 -0800
parents f444739dd8af
children 1639be0967d6
files autoload/vimcrosoft.vim compiler/vimcrosoftsln.vim doc/vimcrosoft.txt doc/vimcrosoft.vim scripts/ycm_extra_conf.py
diffstat 5 files changed, 207 insertions(+), 175 deletions(-) [+]
line wrap: on
line diff
--- a/autoload/vimcrosoft.vim	Thu Sep 24 23:02:16 2020 -0700
+++ b/autoload/vimcrosoft.vim	Fri Jan 22 16:42:25 2021 -0800
@@ -62,6 +62,13 @@
     return 0
 endfunction
 
+function! vimcrosoft#get_msbuild_errorformat() abort
+    " MSBuild error formats look like this:
+    " Path\To\Source\Filename.cpp|53| error C2065: 'MyClass': undeclared identifier [Path\To\MyProject.vcxproj]
+    return '%*[^\ ]\ %f\|%l\|\ %trror\ \D%n:\ %m\ [%o]'
+                " \'\|\|\ %f\|%l\|\ %tarning\ \D%n:\ %m\ [%o]'
+endfunction
+
 " }}}
 
 " Cache Files {{{
--- a/compiler/vimcrosoftsln.vim	Thu Sep 24 23:02:16 2020 -0700
+++ b/compiler/vimcrosoftsln.vim	Fri Jan 22 16:42:25 2021 -0800
@@ -22,6 +22,9 @@
 execute "CompilerSet makeprg=".s:prgcmdline
 
 CompilerSet errorformat&
+"execute "CompilerSet errorformat=".vimcrosoft#get_msbuild_errorformat()
+"echom "Set errorformat!"
+"echom &errorformat
 
 let &cpo = s:keepcpo
 unlet s:keepcpo
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/doc/vimcrosoft.txt	Fri Jan 22 16:42:25 2021 -0800
@@ -0,0 +1,169 @@
+*vimcrosoft.txt*  Work with Visual Studio solutions in Vim
+
+
+$$\    $$\$$$$$$\$$\      $$\ $$$$$$\ $$$$$$$\  $$$$$$\  $$$$$$\  $$$$$$\ $$$$$$$$\$$$$$$$$\ 
+$$ |   $$ \_$$  _$$$\    $$$ $$  __$$\$$  __$$\$$  __$$\$$  __$$\$$  __$$\$$  _____\__$$  __|
+$$ |   $$ | $$ | $$$$\  $$$$ $$ /  \__$$ |  $$ $$ /  $$ $$ /  \__$$ /  $$ $$ |        $$ |   
+\$$\  $$  | $$ | $$\$$\$$ $$ $$ |     $$$$$$$  $$ |  $$ \$$$$$$\ $$ |  $$ $$$$$\      $$ |   
+ \$$\$$  /  $$ | $$ \$$$  $$ $$ |     $$  __$$<$$ |  $$ |\____$$\$$ |  $$ $$  __|     $$ |   
+  \$$$  /   $$ | $$ |\$  /$$ $$ |  $$\$$ |  $$ $$ |  $$ $$\   $$ $$ |  $$ $$ |        $$ |   
+   \$  /  $$$$$$\$$ | \_/ $$ \$$$$$$  $$ |  $$ |$$$$$$  \$$$$$$  |$$$$$$  $$ |        $$ |   
+    \_/   \______\__|     \__|\______/\__|  \__|\______/ \______/ \______/\__|        \__|   
+
+
+                                   VIM-CROSOFT
+
+                                                                  *vimcrosoft*
+
+==============================================================================
+Configuration                                       *vimcrosoft-configuration*
+
+                                                          *g:vimcrosoft_trace*
+g:vimcrosoft_trace
+                        Enables debugging information.
+                        Default: `0`
+
+                                                  *g:vimcrosoft_auto_find_sln*
+g:vimcrosoft_auto_find_sln
+                        Try and find a solution for the current working
+                        directory on Vim startup. This effectively executes
+                        |:VimcrosoftAutoFindSln| upon startup.
+                        Default: `0`
+
+                                                     *g:vimcrosoft_sln_finder*
+g:vimcrosoft_sln_finder
+                        The name of a function to call to find a solution file
+                        from a given current path. If not set, Vimcrosoft will
+                        use its own default finder, which just walks up the
+                        directory tree until it finds any `*.sln` files.
+                        Default: `""`
+
+                                                   *g:vimcrosoft_msbuild_path*
+g:vimcrosoft_msbuild_path
+                        By default, Vimcrosoft automatically finds where
+                        MSBuild is installed. If that fails, you can specify
+                        the path to the MSBuild executable directly.
+                        Default: `""`
+
+                                                   *g:vimcrosoft_make_command*
+g:vimcrosoft_make_command
+                        The command to run when starting builds. If empty,
+                        Vimcrosoft will use |:make|, unless the vim-dispatch
+                        plugin is detected, in which case it will use |:Make|.
+                        If the option is not empty, it will use whatever you
+                        specified.
+                        Default: `""`
+
+==============================================================================
+Commands                                                 *vimcrosoft-commands*
+
+                                                *vimcrosoft-solution-commands*
+Here's a list of solution-related commands:
+
+                                                      *:VimcrosoftAutoFindSln*
+:VimcrosoftAutoFindSln
+                        Finds a solution file (`*.sln`) in the current working
+                        directory, or any of its parent directories, and sets
+                        it as the current solution file (see 
+                        |:VimcrosoftSetSln|). If any solution files are found,
+                        the first one is used.
+
+                                                           *:VimcrosoftSetSln*
+:VimcrosoftSetSln <file>
+                        Sets the currently active solution file. All
+                        vim-crosoft commands will relate to this solution.
+
+                                                         *:VimcrosoftUnsetSln*
+:VimcrosoftUnsetSln
+                        Unsets the currently active solution file.
+
+                                                *:VimcrosoftSetConfigPlatform*
+:VimcrosoftSetConfigPlatform <configplatform>
+                        Sets the currently active configuration and platform
+                        for the active solution. The argument is a combo of
+                        configuration and platform, in the form of
+                        `Configuration|Platform`.
+
+                                                         *:VimcrosoftBuildSln*
+:VimcrosoftBuildSln
+                        Starts a build on the current solution, using the
+                        current configuration and platform.
+
+                                                       *:VimcrosoftRebuildSln*
+:VimcrosoftRebuildSln
+                        Rebuilds the current solution, using the current
+                        configuration and platform.
+
+                                                         *:VimcrosoftCleanSln*
+:VimcrosoftCleanSln
+                        Cleans the current solution for the current
+                        configuration and platform.
+
+
+                                                 *vimcrosoft-project-commands*
+Here are some project-related commands:
+
+                                                     *:VimcrosoftBuildProject*
+:VimcrosoftBuildProject
+                        Builds the active project for the current
+                        configuration and platform. MSBuild will typically
+                        build all its dependencies first.
+
+                                                 *:VimcrosoftBuildProjectOnly*
+:VimcrosoftBuildProjectOnly
+                        Builds the active project for the current
+                        configuration and platform, but skips building any
+                        dependencies.
+
+                                                   *:VimcrosoftRebuildProject*
+:VimcrosoftRebuildProject
+                        Rebuilds the active project for the current
+                        configuration and platform.
+
+                                                     *:VimcrosoftCleanProject*
+:VimcrosoftCleanProject
+                        Cleans the active project for the current
+                        configuration and platform.
+
+
+                                          *vimcrosoft-active-project-commands*
+Vimcrosoft lets you specify an "active project" that makes it quicker to
+build/clean/etc.
+
+                                                 *:VimcrosoftSetActiveProject*
+:VimcrosoftSetActiveProject
+                        Sets the active project for the current solution. This
+                        enables a few "shortcut" commands that operate on it
+                        directly.
+
+                                               *:VimcrosoftBuildActiveProject*
+:VimcrosoftBuildActiveProject
+                        Builds the active project for the current
+                        configuration and platform. MSBuild will typically
+                        build all its dependencies first.
+
+                                           *:VimcrosoftBuildActiveProjectOnly*
+:VimcrosoftBuildActiveProjectOnly
+                        Builds the active project for the current
+                        configuration and platform, but skips building any
+                        dependencies.
+
+                                             *:VimcrosoftRebuildActiveProject*
+:VimcrosoftRebuildActiveProject
+                        Rebuilds the active project for the current
+                        configuration and platform.
+
+                                               *:VimcrosoftCleanActiveProject*
+:VimcrosoftCleanActiveProject
+                        Cleans the active project for the current
+                        configuration and platform.
+
+
+==============================================================================
+Statusline                                             *vimcrosoft-statusline*
+
+You can show some vimcrosoft-related information in your 'statusline' by
+calling the `vimcrosoft#statusline()` function.
+
+
+" vim:tw=78:et:ft=help:norl:
--- a/doc/vimcrosoft.vim	Thu Sep 24 23:02:16 2020 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,169 +0,0 @@
-*vimcrosoft.txt*  Work with Visual Studio solutions in Vim
-
-
-$$\    $$\$$$$$$\$$\      $$\ $$$$$$\ $$$$$$$\  $$$$$$\  $$$$$$\  $$$$$$\ $$$$$$$$\$$$$$$$$\ 
-$$ |   $$ \_$$  _$$$\    $$$ $$  __$$\$$  __$$\$$  __$$\$$  __$$\$$  __$$\$$  _____\__$$  __|
-$$ |   $$ | $$ | $$$$\  $$$$ $$ /  \__$$ |  $$ $$ /  $$ $$ /  \__$$ /  $$ $$ |        $$ |   
-\$$\  $$  | $$ | $$\$$\$$ $$ $$ |     $$$$$$$  $$ |  $$ \$$$$$$\ $$ |  $$ $$$$$\      $$ |   
- \$$\$$  /  $$ | $$ \$$$  $$ $$ |     $$  __$$<$$ |  $$ |\____$$\$$ |  $$ $$  __|     $$ |   
-  \$$$  /   $$ | $$ |\$  /$$ $$ |  $$\$$ |  $$ $$ |  $$ $$\   $$ $$ |  $$ $$ |        $$ |   
-   \$  /  $$$$$$\$$ | \_/ $$ \$$$$$$  $$ |  $$ |$$$$$$  \$$$$$$  |$$$$$$  $$ |        $$ |   
-    \_/   \______\__|     \__|\______/\__|  \__|\______/ \______/ \______/\__|        \__|   
-
-
-                                   VIM-CROSOFT
-
-                                                                  *vimcrosoft*
-
-==============================================================================
-Configuration                                       *vimcrosoft-configuration*
-
-                                                          *g:vimcrosoft_trace*
-g:vimcrosoft_trace
-                        Enables debugging information.
-                        Default: `0`
-
-                                                  *g:vimcrosoft_auto_find_sln*
-g:vimcrosoft_auto_find_sln
-                        Try and find a solution for the current working
-                        directory on Vim startup. This effectively executes
-                        |:VimcrosoftAutoFindSln| upon startup.
-                        Default: `0`
-
-                                                     *g:vimcrosoft_sln_finder*
-g:vimcrosoft_sln_finder
-                        The name of a function to call to find a solution file
-                        from a given current path. If not set, Vimcrosoft will
-                        use its own default finder, which just walks up the
-                        directory tree until it finds any `*.sln` files.
-                        Default: `""`
-
-                                                   *g:vimcrosoft_msbuild_path*
-g:vimcrosoft_msbuild_path
-                        By default, Vimcrosoft automatically finds where
-                        MSBuild is installed. If that fails, you can specify
-                        the path to the MSBuild executable directly.
-                        Default: `""`
-
-                                                   *g:vimcrosoft_make_command*
-g:vimcrosoft_make_command
-                        The command to run when starting builds. If empty,
-                        Vimcrosoft will use |:make|, unless the vim-dispatch
-                        plugin is detected, in which case it will use |:Make|.
-                        If the option is not empty, it will use whatever you
-                        specified.
-                        Default: `""`
-
-==============================================================================
-Commands                                                 *vimcrosoft-commands*
-
-                                                *vimcrosoft-solution-commands*
-Here's a list of solution-related commands:
-
-                                                      *:VimcrosoftAutoFindSln*
-:VimcrosoftAutoFindSln
-                        Finds a solution file (`*.sln`) in the current working
-                        directory, or any of its parent directories, and sets
-                        it as the current solution file (see 
-                        |:VimcrosoftSetSln|). If any solution files are found,
-                        the first one is used.
-
-                                                           *:VimcrosoftSetSln*
-:VimcrosoftSetSln <file>
-                        Sets the currently active solution file. All
-                        vim-crosoft commands will relate to this solution.
-
-                                                         *:VimcrosoftUnsetSln*
-:VimcrosoftUnsetSln
-                        Unsets the currently active solution file.
-
-                                                *:VimcrosoftSetConfigPlatform*
-:VimcrosoftSetConfigPlatform <configplatform>
-                        Sets the currently active configuration and platform
-                        for the active solution. The argument is a combo of
-                        configuration and platform, in the form of
-                        `Configuration|Platform`.
-
-                                                         *:VimcrosoftBuildSln*
-:VimcrosoftBuildSln
-                        Starts a build on the current solution, using the
-                        current configuration and platform.
-
-                                                       *:VimcrosoftRebuildSln*
-:VimcrosoftRebuildSln
-                        Rebuilds the current solution, using the current
-                        configuration and platform.
-
-                                                         *:VimcrosoftCleanSln*
-:VimcrosoftCleanSln
-                        Cleans the current solution for the current
-                        configuration and platform.
-
-
-                                                 *vimcrosoft-project-commands*
-Here are some project-related commands:
-
-                                                     *:VimcrosoftBuildProject*
-:VimcrosoftBuildProject
-                        Builds the active project for the current
-                        configuration and platform. MSBuild will typically
-                        build all its dependencies first.
-
-                                                 *:VimcrosoftBuildProjectOnly*
-:VimcrosoftBuildProjectOnly
-                        Builds the active project for the current
-                        configuration and platform, but skips building any
-                        dependencies.
-
-                                                   *:VimcrosoftRebuildProject*
-:VimcrosoftRebuildProject
-                        Rebuilds the active project for the current
-                        configuration and platform.
-
-                                                     *:VimcrosoftCleanProject*
-:VimcrosoftCleanProject
-                        Cleans the active project for the current
-                        configuration and platform.
-
-
-                                          *vimcrosoft-active-project-commands*
-Vimcrosoft lets you specify an "active project" that makes it quicker to
-build/clean/etc.
-
-                                                 *:VimcrosoftSetActiveProject*
-:VimcrosoftSetActiveProject
-                        Sets the active project for the current solution. This
-                        enables a few "shortcut" commands that operate on it
-                        directly.
-
-                                               *:VimcrosoftBuildActiveProject*
-:VimcrosoftBuildActiveProject
-                        Builds the active project for the current
-                        configuration and platform. MSBuild will typically
-                        build all its dependencies first.
-
-                                           *:VimcrosoftBuildActiveProjectOnly*
-:VimcrosoftBuildActiveProjectOnly
-                        Builds the active project for the current
-                        configuration and platform, but skips building any
-                        dependencies.
-
-                                             *:VimcrosoftRebuildActiveProject*
-:VimcrosoftRebuildActiveProject
-                        Rebuilds the active project for the current
-                        configuration and platform.
-
-                                               *:VimcrosoftCleanActiveProject*
-:VimcrosoftCleanActiveProject
-                        Cleans the active project for the current
-                        configuration and platform.
-
-
-==============================================================================
-Statusline                                             *vimcrosoft-statusline*
-
-You can show some vimcrosoft-related information in your 'statusline' by
-calling the `vimcrosoft#statusline()` function.
-
-
-" vim:tw=78:et:ft=help:norl:
--- a/scripts/ycm_extra_conf.py	Thu Sep 24 23:02:16 2020 -0700
+++ b/scripts/ycm_extra_conf.py	Fri Jan 22 16:42:25 2021 -0800
@@ -54,18 +54,40 @@
         incfiles += item_incfiles
         return True
 
-    logger.debug("Requested item didn't have any flags, looking for companion item")
+    logger.debug("Requested item didn't have any flags, looking for related items")
     from find_companion import _find_companion_item
     companion_item = _find_companion_item(solution, filename, slncache=slncache)
     if companion_item:
-        logger.debug("Found companion item: %s" % companion_item)
         item_incpaths, item_incfiles = _get_item_specific_flags(projdir, clcompileitems, companion_item)
-        incpaths += item_incpaths
-        incfiles += item_incfiles
-        return True
+        if item_incpaths or item_incfiles:
+            logger.debug("Found flags on companion item: %s" % companion_item)
+            incpaths += item_incpaths
+            incfiles += item_incfiles
+            return True
 
     #logger.debug("No companion item found, see if we can find flags for a neighbour")
-    #os.path.dirname(filename)
+    #dirname = os.path.dirname(filename)
+    #neighbournames = os.listdir(dirname)
+    #neighbournames.remove(os.path.basename(filename))
+    #for neighbourname in neighbournames:
+    #    neighbourpath = os.path.join(dirname, neighbourname)
+    #    item_incpaths, item_incfiles = _get_item_specific_flags(projdir, clcompileitems, neighbourpath)
+    #    if item_incpaths or item_incfiles:
+    #        logger.debug("Found flags on: %d" % neighbourpath)
+    #        incpaths += item_incpaths
+    #        incfiles += item_incfiles
+    #        return True
+
+    #    neighbour_companion = _find_companion_item(solution, filename, slncache=slncache)
+    #    if neighbour_companion:
+    #        item_incpaths, item_incfiles = _get_item_specific_flags(projdir, clcompileitems, neighbour_companion)
+    #        if item_incpaths or item_incfiles:
+    #            logger.debug("Found flags on: %s" % neighbour_companion)
+    #            incpaths += item_incpaths
+    #            incfiles += item_incfiles
+    #            return True
+
+    #logger.debug("No flags found anywhere...")
     return False