Skip to content

wrapLineLength should not split fat arrow definitions #673

@Qriist

Description

@Qriist

Description

Fat arrow functions are apparently required to be defined all the same line before the actual fat arrow. In the example below I'm interacting with a DLL callback with a bunch of expected paramaters; I need to mirror the same number of inputs so my formatting options are limited.

The auto-formatting kept breaking the fat arrow function until I bumped the wrapLineLength setting up from 120 to 140. Thankfully, that seems like it should be an easy fix on your end. :)

Expected formatted output snippet

Image
        ExportSSLs(easy_handle?, share_handle?) {
            easy_handle ??= this.easyHandleMap[0][1] ;defaults to the first created easy_handle
            share_handle ??= this.shareHandleMap[0][1] ;defaults to the first created share_handle

            retArr := []
            retArrPtr := ObjPtr(retArr)

            ;create the callback to the export function
            CBF := CallbackCreate(
                (easy_handle, retArr, session_key, shmac, shmac_len, sdata, sdata_le, valid_until, ietf_tls_id, alpn, earlydata_max) =>
                    this._SSLExportCallbackFunction(easy_handle, retArrPtr, session_key, shmac, shmac_len, sdata,
                        sdata_le, valid_until, ietf_tls_id, alpn, earlydata_max)
            )

            ;proc the export
            if ret := this._curl_easy_ssls_export(easy_handle, CBF, share_handle)
                this._ErrorHandler(A_ThisFunc, "CURLcode", "curl_easy_ssls_export", ret, this.easyHandleMap[easy_handle
                    ]["error buffer"], easy_handle)

            ;callback doesn't need to be stored as this is a one-shot operation
            CallbackFree(CBF)

            return retArr
        }

Actual formatted output snippet

Image
        ExportSSLs(easy_handle?, share_handle?) {
            easy_handle ??= this.easyHandleMap[0][1] ;defaults to the first created easy_handle
            share_handle ??= this.shareHandleMap[0][1] ;defaults to the first created share_handle

            retArr := []
            retArrPtr := ObjPtr(retArr)

            ;create the callback to the export function
            CBF := CallbackCreate(
                (easy_handle, retArr, session_key, shmac, shmac_len, sdata, sdata_le, valid_until, ietf_tls_id, alpn,
                    earlydata_max) =>
                    this._SSLExportCallbackFunction(easy_handle, retArrPtr, session_key, shmac, shmac_len, sdata,
                        sdata_le, valid_until, ietf_tls_id, alpn, earlydata_max)
            )

            ;proc the export
            if ret := this._curl_easy_ssls_export(easy_handle, CBF, share_handle)
                this._ErrorHandler(A_ThisFunc, "CURLcode", "curl_easy_ssls_export", ret, this.easyHandleMap[easy_handle
                    ]["error buffer"], easy_handle)

            ;callback doesn't need to be stored as this is a one-shot operation
            CallbackFree(CBF)

            return retArr
        }

Additional context

Metadata

Metadata

Assignees

Labels

bugsomething isn't workingformattercode formatter issues

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions