yo1dog / vscode-cursor-align

Visual Studio Code Extension that aligns all cursors using spaces.
MIT License
22 stars 7 forks source link

Weird align error #9

Closed Awbmilne closed 2 years ago

Awbmilne commented 2 years ago

It seems i've come across a rare align error...

The align works everywhere just fine in the past. For some reason, this bit of code creates errors...

lib\include\util.h from Intel SDO - client-sdk-fidoiot

#if defined(TARGET_OS_LINUX) || defined(TARGET_OS_FREERTOS) || \
    defined(TARGET_OS_MBEDOS) || defined(TARGET_OS_OPTEE) || \
    defined(TARGET_OS_VXWORKS)
#include <stdio.h>
#include <time.h>
#include <string.h>
#define TIMESTAMP_LEN 9
#define LOG(level, ...)                                                        \
    {                                                                      \
        if (level <= LOG_LEVEL) {                                      \
            if (level == LOG_ERROR) {                              \
                printf("ERROR:[%s():%d] ", __func__, __LINE__);\
            }                                                      \
            if (level == LOG_DEBUG) {                              \
                if (print_timestamp() != 0)                    \
                    printf("Time_stamp ERROR\n");          \
            }                                                      \
            printf(__VA_ARGS__);                                   \
        }                                                              \
    }
#endif

Trying to align the slashes at the end of each line works improperly, shown by the gif below:
align-error

Awbmilne commented 2 years ago

Wait...

In posting this, the alignment is correct... Seems it may be my VScode 🤔

Awbmilne commented 2 years ago

Nevermind, turns out that VScode was rendering the tabs at a different depth, but the spaces after the text where kept the same length. Cursor Align worked fine. just the raw text was not the same as what was displayed!