在Visual Studio Code中隐藏ts和tsx生成的JS文件

时间:2017-05-28 14:20:10

标签: typescript visual-studio-code

此问题has previously been asked用于隐藏.js.js.map文件,当存在具有相同基本名称的.ts文件时。答案是您将VS Code设置设置为排除"**/*.js": {"when": "$(basename).ts"}

但是,我想知道当基本名称为.js.ts时,如何隐藏.tsx文件。我需要VS Code检查是否有任何扩展。

基本上我需要同时拥有"**/*.js": {"when": "$(basename).ts"}"**/*.js": {"when": "$(basename).tsx"}。关于如何完成任务的任何想法?

1 个答案:

答案 0 :(得分:4)

您可以使用位技巧来执行此操作,如VS Code文档中的mentioned

要排除从.ts和.tsx源文件生成的JavaScript文件,请使用以下表达式:

#include <stdio.h> #include <stdlib.h> #include <sys/time.h> #define DEFAULT_NMAX 10000000 #define DEFAULT_NR DEFAULT_NMAX #define DEFAULT_INC 10 #define DEFAULT_XIDX 0 #define MAX_PATH_LENGTH 1024 // #define WINOS #define STACKALLOC #ifdef WINOS #include <windows.h> #endif static void dummy(double A[], double B[], double C[], double D[]) { return; } static double simulation(int N, int R) { int i, j; #ifdef STACKALLOC double A[N]; double B[N]; double C[N]; double D[N]; #else double * A = malloc(N*sizeof(double)); double * B = malloc(N*sizeof(double)); double * C = malloc(N*sizeof(double)); double * D = malloc(N*sizeof(double)); #endif double elaps; for (i = 0; i < N; ++i) { A[i] = 0.00; B[i] = 1.00; C[i] = 2.00; D[i] = 3.00; } #ifdef WINOS FILETIME tp; GetSystemTimePreciseAsFileTime(&tp); elaps = - (double)(((ULONGLONG)tp.dwHighDateTime << 32) | (ULONGLONG)tp.dwLowDateTime)/10000000.0; #else struct timeval tp; gettimeofday(&tp, NULL); elaps = -(double)(tp.tv_sec + tp.tv_usec/1000000.0); #endif for(j=0; j<R; ++j) { for(i=0; i<N; ++i) A[i] = B[i] + C[i]*D[i]; if(A[2] < 0) dummy(A, B, C, D); } #ifndef STACKALLOC free(A); free(B); free(C); free(D); #endif #ifdef WINOS GetSystemTimePreciseAsFileTime(&tp); return elaps + (double)(((ULONGLONG)tp.dwHighDateTime << 32) | (ULONGLONG)tp.dwLowDateTime)/10000000.0; #else gettimeofday(&tp, NULL); return elaps + ((double)(tp.tv_sec + tp.tv_usec/1000000.0)); #endif } int main(int argc, char *argv[]) { const int NR = argc > 1 ? atoi(argv[1]) : DEFAULT_NR; const int NMAX = argc > 2 ? atoi(argv[2]) : DEFAULT_NMAX; const int inc = argc > 3 ? atoi(argv[3]) : DEFAULT_INC; const int xidx = argc > 4 ? atoi(argv[4]) : DEFAULT_XIDX; int i, j, k; FILE * fp; printf("\n*** Schonauer Triad benchmark ***\n"); char csvname[MAX_PATH_LENGTH]; sprintf(csvname, "data%d.csv", xidx); if(!(fp = fopen(csvname, "a+"))) { printf("\nError whilst writing to file\n"); return 1; } int R, N; double MFLOPS; double elaps; for(N=1; N<=NMAX; N += inc) { R = NR/N; elaps = simulation(N, R); MFLOPS = ((R*N)<<1)/(elaps*1000000); fprintf(fp, "%d,%lf\n", N, MFLOPS); printf("N = %d, R = %d\n", N, R); printf("Elapsed time: %lf\n", elaps); printf("MFLOPS: %lf\n", MFLOPS); } fclose(fp); (void) getchar(); return 0; }

an open issue跟踪类似的请求,但目前没有ETA。