( namespace )
| 1173 | |
| 1174 | |
| 1175 | def InsertNamespace( namespace ): |
| 1176 | if VariableExists( 'g:ycm_csharp_insert_namespace_expr' ): |
| 1177 | expr = GetVariableValue( 'g:ycm_csharp_insert_namespace_expr' ) |
| 1178 | if expr: |
| 1179 | SetVariableValue( "g:ycm_namespace_to_insert", namespace ) |
| 1180 | vim.eval( expr ) |
| 1181 | return |
| 1182 | |
| 1183 | pattern = r'^\s*using\(\s\+[a-zA-Z0-9]\+\s\+=\)\?\s\+[a-zA-Z0-9.]\+\s*;\s*' |
| 1184 | existing_indent = '' |
| 1185 | line = SearchInCurrentBuffer( pattern ) |
| 1186 | if line: |
| 1187 | existing_line = LineTextInCurrentBuffer( line ) |
| 1188 | existing_indent = re.sub( r'\S.*', '', existing_line ) |
| 1189 | new_line = f'{ existing_indent }using { namespace };\n' |
| 1190 | replace_pos = { 'line_num': line + 1, 'column_num': 1 } |
| 1191 | ReplaceChunk( replace_pos, replace_pos, new_line, vim.current.buffer ) |
| 1192 | PostVimMessage( f'Add namespace: { namespace }', warning = False ) |
| 1193 | |
| 1194 | |
| 1195 | def SearchInCurrentBuffer( pattern ): |
nothing calls this directly
no test coverage detected