File tree Expand file tree Collapse file tree 5 files changed +13
-6
lines changed Expand file tree Collapse file tree 5 files changed +13
-6
lines changed Original file line number Diff line number Diff line change 2
2
* Wraps fs and path into a nice "consistentPath" API
3
3
*/
4
4
"use strict" ;
5
- /** we work with "/" for all paths (so does the typescript language service) */
6
5
function consistentPath ( filePath ) {
7
6
return filePath . split ( '\\' ) . join ( '/' ) ;
8
7
}
9
8
exports . consistentPath = consistentPath ;
10
9
const path = require ( "path" ) ;
10
+ // Atom uses system dependent path separators while Typescript uses /. Unfortunately, we
11
+ // needs this to make sure things like lint errors work.
12
+ exports . systemPath = path . sep === "\\" ? filePath => filePath . replace ( / \/ / g, "\\" ) : filePath => filePath ;
11
13
/**
12
14
* Resolves to to an absolute path.
13
15
* @param from,to,to,to...
Original file line number Diff line number Diff line change @@ -9,11 +9,12 @@ class ErrorPusher {
9
9
const errors = [ ] ;
10
10
for ( const fileErrors of this . errors . values ( ) ) {
11
11
for ( const [ filePath , diagnostics ] of fileErrors ) {
12
+ const _filePath = utils_1 . systemPath ( filePath ) ;
12
13
for ( const diagnostic of diagnostics ) {
13
14
errors . push ( {
14
15
type : "Error" ,
15
16
text : diagnostic . text ,
16
- filePath : filePath ,
17
+ filePath : _filePath ,
17
18
range : diagnostic . start ? utils_1 . locationsToRange ( diagnostic . start , diagnostic . end ) : undefined
18
19
} ) ;
19
20
}
Original file line number Diff line number Diff line change 2
2
* Wraps fs and path into a nice "consistentPath" API
3
3
*/
4
4
5
- /** we work with "/" for all paths (so does the typescript language service) */
6
5
export function consistentPath ( filePath : string ) : string {
7
- return filePath . split ( '\\' ) . join ( '/' ) ;
6
+ return filePath . split ( '\\' ) . join ( '/' ) ;
8
7
}
9
8
10
9
import * as path from "path" ;
11
10
11
+ // Atom uses system dependent path separators while Typescript uses /. Unfortunately, we
12
+ // needs this to make sure things like lint errors work.
13
+ export const systemPath : ( filePath : string ) => string = path . sep === "\\" ? filePath => filePath . replace ( / \/ / g, "\\" ) : filePath => filePath
14
+
12
15
/**
13
16
* Resolves to to an absolute path.
14
17
* @param from,to,to,to...
Original file line number Diff line number Diff line change 1
1
import { debounce } from "lodash"
2
2
import { Diagnostic } from "typescript/lib/protocol"
3
3
import { Linter , LinterMessage } from "../typings/linter"
4
- import { locationsToRange } from "./atom/utils"
4
+ import { locationsToRange , systemPath } from "./atom/utils"
5
5
6
6
/** Class that collects errors from all of the clients and pushes them to the Linter service */
7
7
export class ErrorPusher {
@@ -38,11 +38,12 @@ export class ErrorPusher {
38
38
39
39
for ( const fileErrors of this . errors . values ( ) ) {
40
40
for ( const [ filePath , diagnostics ] of fileErrors ) {
41
+ const _filePath = systemPath ( filePath )
41
42
for ( const diagnostic of diagnostics ) {
42
43
errors . push ( {
43
44
type : "Error" ,
44
45
text : diagnostic . text ,
45
- filePath : filePath ,
46
+ filePath : _filePath ,
46
47
range : diagnostic . start ? locationsToRange ( diagnostic . start , diagnostic . end ) : undefined
47
48
} )
48
49
}
You can’t perform that action at this time.
0 commit comments