(self, **kwargs)
LIGHTNING:
            {
              "result": "markup:\/\/mm2:bar:3,19: ParseError at [row,col]:[4,19]\nMessage: XML document structures must start and end within the same entity.: Source",
              "success": false,
              "stack": "FIELD_INTEGRITY_EXCEPTION: markup:\/\/mm2:bar:3,19: ParseError at [row,col]:[4,19]\nMessage: XML document structures must start and end within the same entity.: Source\n    at onResponse (\/Users\/josephferraro\/Development\/Github\/MavensMate\/node_modules\/jsforce\/lib\/connection.js:368:13)\n    at _fulfilled (\/Users\/josephferraro\/Development\/Github\/MavensMate\/node_modules\/jsforce\/node_modules\/q\/q.js:798:54)\n    at self.promiseDispatch.done (\/Users\/josephferraro\/Development\/Github\/MavensMate\/node_modules\/jsforce\/node_modules\/q\/q.js:827:30)\n    at Promise.promise.promiseDispatch (\/Users\/josephferraro\/Development\/Github\/MavensMate\/node_modules\/jsforce\/node_modules\/q\/q.js:760:13)\n    at \/Users\/josephferraro\/Development\/Github\/MavensMate\/node_modules\/jsforce\/node_modules\/q\/q.js:574:44\n    at flush (\/Users\/josephferraro\/Development\/Github\/MavensMate\/node_modules\/jsforce\/node_modules\/q\/q.js:108:17)\n    at process._tickCallback (node.js:419:13)"
            }

            TOOLING/METADATA:
            {
              "result": {
                "checkOnly": false,
                "completedDate": "",
                "createdBy": "",
                "createdByName": "",
                "createdDate": "",
                "details": {
                  "componentSuccesses": [

                  ],
                  "runTestResult": {
                    "numFailures": "0",
                    "numTestsRun": "0",
                    "totalTime": "0.0"
                  },
                  "componentFailures": [
                    {
                      "attributes": {
                        "type": "ContainerAsyncRequest",
                        "url": "\/services\/data\/v32.0\/tooling\/sobjects\/ContainerAsyncRequest\/1dro0000000mhNbAAI"
                      },
                      "Id": "1dro0000000mhNbAAI",
                      "MetadataContainerId": "1dco0000000JuxBAAS",
                      "MetadataContainerMemberId": null,
                      "State": "Failed",
                      "IsCheckOnly": false,
                      "DeployDetails": {
                        "allComponentMessages": [
                          {
                            "changed": false,
                            "columnNumber": -1,
                            "componentType": "ApexClass",
                            "created": false,
                            "createdDate": "2015-02-12T02:59:21.986+0000",
                            "deleted": false,
                            "fileName": "ChangePasswordController",
                            "forPackageManifestFile": false,
                            "fullName": "ChangePasswordController",
                            "id": "01po0000001iVdVAAU",
                            "knownPackagingProblem": false,
                            "lineNumber": 16,
                            "problem": "expecting right curly bracket, found '&lt;EOF&gt;'",
                            "problemType": "Error",
                            "requiresProductionTestRun": false,
                            "success": false,
                            "warning": false
                          }
                        ],
                        "componentFailures": [
                          {
                            "changed": false,
                            "columnNumber": -1,
                            "componentType": "ApexClass",
                            "created": false,
                            "createdDate": "2015-02-12T02:59:21.986+0000",
                            "deleted": false,
                            "fileName": "ChangePasswordController",
                            "forPackageManifestFile": false,
                            "fullName": "ChangePasswordController",
                            "id": "01po0000001iVdVAAU",
                            "knownPackagingProblem": false,
                            "lineNumber": 16,
                            "problem": "expecting right curly bracket, found '&lt;EOF&gt;'",
                            "problemType": "Error",
                            "requiresProductionTestRun": false,
                            "success": false,
                            "warning": false
                          }
                        ],
                        "componentSuccesses": [

                        ],
                        "runTestResult": null
                      },
                      "ErrorMsg": null
                    }
                  ]
                },
                "done": false,
                "id": "",
                "ignoreWarnings": false,
                "lastModifiedDate": "",
                "numberComponentErrors": 1,
                "numberComponentsDeployed": 0,
                "numberComponentsTotal": 0,
                "numberTestErrors": 0,
                "numberTestsCompleted": 0,
                "numberTestsTotal": 0,
                "rollbackOnError": false,
                "runTestsEnabled": "false",
                "startDate": "",
                "status": "",
                "success": false
              }
            }
LIGHTNING:
            {
              "result": "markup:\/\/mm2:bar:3,19: ParseError at [row,col]:[4,19]\nMessage: XML document structures must start and end within the same entity.: Source",
              "success": false,
              "stack": "FIELD_INTEGRITY_EXCEPTION: markup:\/\/mm2:bar:3,19: ParseError at [row,col]:[4,19]\nMessage: XML document structures must start and end within the same entity.: Source\n    at onResponse (\/Users\/josephferraro\/Development\/Github\/MavensMate\/node_modules\/jsforce\/lib\/connection.js:368:13)\n    at _fulfilled (\/Users\/josephferraro\/Development\/Github\/MavensMate\/node_modules\/jsforce\/node_modules\/q\/q.js:798:54)\n    at self.promiseDispatch.done (\/Users\/josephferraro\/Development\/Github\/MavensMate\/node_modules\/jsforce\/node_modules\/q\/q.js:827:30)\n    at Promise.promise.promiseDispatch (\/Users\/josephferraro\/Development\/Github\/MavensMate\/node_modules\/jsforce\/node_modules\/q\/q.js:760:13)\n    at \/Users\/josephferraro\/Development\/Github\/MavensMate\/node_modules\/jsforce\/node_modules\/q\/q.js:574:44\n    at flush (\/Users\/josephferraro\/Development\/Github\/MavensMate\/node_modules\/jsforce\/node_modules\/q\/q.js:108:17)\n    at process._tickCallback (node.js:419:13)"
            }
LIGHTNING : { result : markup : \ / \ / mm2 : bar : 3 19 : ParseError at [ row col ] : [ 4 19 ] \ nMessage : XML document structures must start and end within the same entity . : Source success : false stack : FIELD_INTEGRITY_EXCEPTION : markup : \ / \ / mm2 : bar : 3 19 : ParseError at [ row col ] : [ 4 19 ] \ nMessage : XML document structures must start and end within the same entity . : Source \ n at onResponse ( \ / Users \ / josephferraro \ / Development \ / Github \ / MavensMate \ / node_modules \ / jsforce \ / lib \ / connection . js : 368 : 13 ) \ n at _fulfilled ( \ / Users \ / josephferraro \ / Development \ / Github \ / MavensMate \ / node_modules \ / jsforce \ / node_modules \ / q \ / q . js : 798 : 54 ) \ n at self . promiseDispatch . done ( \ / Users \ / josephferraro \ / Development \ / Github \ / MavensMate \ / node_modules \ / jsforce \ / node_modules \ / q \ / q . js : 827 : 30 ) \ n at Promise . promise . promiseDispatch ( \ / Users \ / josephferraro \ / Development \ / Github \ / MavensMate \ / node_modules \ / jsforce \ / node_modules \ / q \ / q . js : 760 : 13 ) \ n at \ / Users \ / josephferraro \ / Development \ / Github \ / MavensMate \ / node_modules \ / jsforce \ / node_modules \ / q \ / q . js : 574 : 44 \ n at flush ( \ / Users \ / josephferraro \ / Development \ / Github \ / MavensMate \ / node_modules \ / jsforce \ / node_modules \ / q \ / q . js : 108 : 17 ) \ n at process . _tickCallback ( node . js : 419 : 13 ) }
def __handle_compile_response(self, **kwargs):
        debug('HANDLING COMPILE!')
        debug(self.response)

        '''
            LIGHTNING:
            {
              "result": "markup:\/\/mm2:bar:3,19: ParseError at [row,col]:[4,19]\nMessage: XML document structures must start and end within the same entity.: Source",
              "success": false,
              "stack": "FIELD_INTEGRITY_EXCEPTION: markup:\/\/mm2:bar:3,19: ParseError at [row,col]:[4,19]\nMessage: XML document structures must start and end within the same entity.: Source\n    at onResponse (\/Users\/josephferraro\/Development\/Github\/MavensMate\/node_modules\/jsforce\/lib\/connection.js:368:13)\n    at _fulfilled (\/Users\/josephferraro\/Development\/Github\/MavensMate\/node_modules\/jsforce\/node_modules\/q\/q.js:798:54)\n    at self.promiseDispatch.done (\/Users\/josephferraro\/Development\/Github\/MavensMate\/node_modules\/jsforce\/node_modules\/q\/q.js:827:30)\n    at Promise.promise.promiseDispatch (\/Users\/josephferraro\/Development\/Github\/MavensMate\/node_modules\/jsforce\/node_modules\/q\/q.js:760:13)\n    at \/Users\/josephferraro\/Development\/Github\/MavensMate\/node_modules\/jsforce\/node_modules\/q\/q.js:574:44\n    at flush (\/Users\/josephferraro\/Development\/Github\/MavensMate\/node_modules\/jsforce\/node_modules\/q\/q.js:108:17)\n    at process._tickCallback (node.js:419:13)"
            }

            TOOLING/METADATA:
            {
              "result": {
                "checkOnly": false,
                "completedDate": "",
                "createdBy": "",
                "createdByName": "",
                "createdDate": "",
                "details": {
                  "componentSuccesses": [

                  ],
                  "runTestResult": {
                    "numFailures": "0",
                    "numTestsRun": "0",
                    "totalTime": "0.0"
                  },
                  "componentFailures": [
                    {
                      "attributes": {
                        "type": "ContainerAsyncRequest",
                        "url": "\/services\/data\/v32.0\/tooling\/sobjects\/ContainerAsyncRequest\/1dro0000000mhNbAAI"
                      },
                      "Id": "1dro0000000mhNbAAI",
                      "MetadataContainerId": "1dco0000000JuxBAAS",
                      "MetadataContainerMemberId": null,
                      "State": "Failed",
                      "IsCheckOnly": false,
                      "DeployDetails": {
                        "allComponentMessages": [
                          {
                            "changed": false,
                            "columnNumber": -1,
                            "componentType": "ApexClass",
                            "created": false,
                            "createdDate": "2015-02-12T02:59:21.986+0000",
                            "deleted": false,
                            "fileName": "ChangePasswordController",
                            "forPackageManifestFile": false,
                            "fullName": "ChangePasswordController",
                            "id": "01po0000001iVdVAAU",
                            "knownPackagingProblem": false,
                            "lineNumber": 16,
                            "problem": "expecting right curly bracket, found '&lt;EOF&gt;'",
                            "problemType": "Error",
                            "requiresProductionTestRun": false,
                            "success": false,
                            "warning": false
                          }
                        ],
                        "componentFailures": [
                          {
                            "changed": false,
                            "columnNumber": -1,
                            "componentType": "ApexClass",
                            "created": false,
                            "createdDate": "2015-02-12T02:59:21.986+0000",
                            "deleted": false,
                            "fileName": "ChangePasswordController",
                            "forPackageManifestFile": false,
                            "fullName": "ChangePasswordController",
                            "id": "01po0000001iVdVAAU",
                            "knownPackagingProblem": false,
                            "lineNumber": 16,
                            "problem": "expecting right curly bracket, found '&lt;EOF&gt;'",
                            "problemType": "Error",
                            "requiresProductionTestRun": false,
                            "success": false,
                            "warning": false
                          }
                        ],
                        "componentSuccesses": [

                        ],
                        "runTestResult": null
                      },
                      "ErrorMsg": null
                    }
                  ]
                },
                "done": false,
                "id": "",
                "ignoreWarnings": false,
                "lastModifiedDate": "",
                "numberComponentErrors": 1,
                "numberComponentsDeployed": 0,
                "numberComponentsTotal": 0,
                "numberTestErrors": 0,
                "numberTestsCompleted": 0,
                "numberTestsTotal": 0,
                "rollbackOnError": false,
                "runTestsEnabled": "false",
                "startDate": "",
                "status": "",
                "success": false
              }
            }
        '''

        #diffing with server
        if 'status' in self.response['result'] and self.response['result']['status'] == 'Conflict':
            conflicts = self.result['details']['conflicts']
            first_conflict_file_name = list(conflicts.keys())[0]
            first_conflict_data = conflicts[first_conflict_file_name]
            diff_merge_settings = config.settings.get('mm_diff_server_conflicts', False)
            conflict_message = 'A conflict has been detected. '+first_conflict_file_name+' was last modified by '+first_conflict_data['remote']['LastModifiedBy']['Name']+' on '+first_conflict_data['remote']['LastModifiedDate']
            if diff_merge_settings:
                if sublime.ok_cancel_dialog(conflict_message, 'Diff with server'):
                    self.__print_to_panel(conflict_message + ". Diffing with server.")
                    th = MavensMateDiffThread(self.thread.window, self.thread.view, first_conflict_data['remote']['tempPath'])
                    th.start()
                else:
                    self.__print_to_panel('Operation canceled.')
            else:
                if sublime.ok_cancel_dialog(conflict_message, "Overwrite Server Copy"):
                    self.__print_to_panel(conflict_message + ". Overwriting server copy.")
                    args = {
                        "paths" : [self.thread.view.file_name()]
                    }
                    sublime.set_timeout(lambda: self.thread.window.run_command('force_compile_file', args), 100)
                else:
                    self.__print_to_panel('Operation canceled.')
        else:
            try:
                success = self.response['result']['success']
                if success:
                    util.clear_marked_line_numbers(self.thread.view)
                    self.__print_to_panel("Success")
                    self.printer.hide()
                    return

                msg = '[OPERATION FAILED]: '

                if type(self.response['result']['details']['componentFailures']) is not list:
                    self.response['result']['details']['componentFailures'] = [self.response['result']['details']['componentFailures']]

                for res in self.response['result']['details']['componentFailures']:
                    if 'DeployDetails' in res and len(res['DeployDetails']['componentFailures']) > 0:
                        for detail in res['DeployDetails']['componentFailures']:
                            debug(detail)
                            line_col = ''
                            line, col = 1, 1
                            if 'lineNumber' in detail and detail['lineNumber'] != None:
                                line = int(detail['lineNumber'])
                                line_col = ' (Line: '+str(line)
                                util.mark_line_numbers(self.thread.view, [line], 'bookmark')
                            if 'columnNumber' in detail and detail['columnNumber'] != None:
                                col = int(detail['columnNumber'])
                                line_col += ', Column: '+str(col)
                            if len(line_col):
                                line_col += ')'

                            #scroll to the line and column of the exception
                            if settings.get('mm_compile_scroll_to_error', True):
                                view = self.thread.view
                                pt = view.text_point(line-1, col-1)
                                view.sel().clear()
                                view.sel().add(sublime.Region(pt))
                                view.show(pt)

                            msg += detail['fileName']+': '+ detail['problem'] + line_col + '\n'
                    elif 'ErrorMsg' in res and res['ErrorMsg'] != None:
                        msg += res['ErrorMsg'] + '\n'
                    else: # metadata api?
                        msg += res['fullName']+': '+ res['problem'] + '\n'

                self.__print_to_panel(msg)

            except Exception as e:
                debug(e)
                debug(traceback.print_exc())
                debug(type(self.response))
                raise e
def __handle_compile_response ( self , * * kwargs ) : debug ( 'HANDLING COMPILE!' ) debug ( self . response ) #diffing with server if 'status' in self . response [ 'result' ] and self . response [ 'result' ] [ 'status' ] == 'Conflict' : conflicts = self . result [ 'details' ] [ 'conflicts' ] first_conflict_file_name = list ( conflicts . keys ( ) ) [ 0 ] first_conflict_data = conflicts [ first_conflict_file_name ] diff_merge_settings = config . settings . get ( 'mm_diff_server_conflicts' , False ) conflict_message = 'A conflict has been detected. ' + first_conflict_file_name + ' was last modified by ' + first_conflict_data [ 'remote' ] [ 'LastModifiedBy' ] [ 'Name' ] + ' on ' + first_conflict_data [ 'remote' ] [ 'LastModifiedDate' ] if diff_merge_settings : if sublime . ok_cancel_dialog ( conflict_message , 'Diff with server' ) : self . __print_to_panel ( conflict_message + ". Diffing with server." ) th = MavensMateDiffThread ( self . thread . window , self . thread . view , first_conflict_data [ 'remote' ] [ 'tempPath' ] ) th . start ( ) else : self . __print_to_panel ( 'Operation canceled.' ) else : if sublime . ok_cancel_dialog ( conflict_message , "Overwrite Server Copy" ) : self . __print_to_panel ( conflict_message + ". Overwriting server copy." ) args = { "paths" : [ self . thread . view . file_name ( ) ] } sublime . set_timeout ( lambda : self . thread . window . run_command ( 'force_compile_file' , args ) , 100 ) else : self . __print_to_panel ( 'Operation canceled.' ) else : try : success = self . response [ 'result' ] [ 'success' ] if success : util . clear_marked_line_numbers ( self . thread . view ) self . __print_to_panel ( "Success" ) self . printer . hide ( ) return msg = '[OPERATION FAILED]: ' if type ( self . response [ 'result' ] [ 'details' ] [ 'componentFailures' ] ) is not list : self . response [ 'result' ] [ 'details' ] [ 'componentFailures' ] = [ self . response [ 'result' ] [ 'details' ] [ 'componentFailures' ] ] for res in self . response [ 'result' ] [ 'details' ] [ 'componentFailures' ] : if 'DeployDetails' in res and len ( res [ 'DeployDetails' ] [ 'componentFailures' ] ) > 0 : for detail in res [ 'DeployDetails' ] [ 'componentFailures' ] : debug ( detail ) line_col = '' line , col = 1 , 1 if 'lineNumber' in detail and detail [ 'lineNumber' ] != None : line = int ( detail [ 'lineNumber' ] ) line_col = ' (Line: ' + str ( line ) util . mark_line_numbers ( self . thread . view , [ line ] , 'bookmark' ) if 'columnNumber' in detail and detail [ 'columnNumber' ] != None : col = int ( detail [ 'columnNumber' ] ) line_col += ', Column: ' + str ( col ) if len ( line_col ) : line_col += ')' #scroll to the line and column of the exception if settings . get ( 'mm_compile_scroll_to_error' , True ) : view = self . thread . view pt = view . text_point ( line - 1 , col - 1 ) view . sel ( ) . clear ( ) view . sel ( ) . add ( sublime . Region ( pt ) ) view . show ( pt ) msg += detail [ 'fileName' ] + ': ' + detail [ 'problem' ] + line_col + '\n' elif 'ErrorMsg' in res and res [ 'ErrorMsg' ] != None : msg += res [ 'ErrorMsg' ] + '\n' else : # metadata api? msg += res [ 'fullName' ] + ': ' + res [ 'problem' ] + '\n' self . __print_to_panel ( msg ) except Exception as e : debug ( e ) debug ( traceback . print_exc ( ) ) debug ( type ( self . response ) ) raise e