Skip to content

Commit

Permalink
add coffeesense.fileExtensions setting for usage outside of VSCode
Browse files Browse the repository at this point in the history
  • Loading branch information
phil294 committed Feb 25, 2022
1 parent a414b5f commit 1514bd4
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
10 changes: 10 additions & 0 deletions docs/guide/setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,16 @@ To get full support for CoffeeScript for files with an extension other than `.co
```
More sophisticated glob patterns other than exactly `"*.some-extension"` are not supported.

If you are using another IDE where this setting does not exist, you can instead specify custom file extensions via hidden setting in `coffeesense.config.js` (see below):
```js
// coffeesense.config.js
module.exports = {
settings: {
"coffeesense.fileExtensions": [ "coffee2" ]
}
}
```

## Multi-root
If you use monorepo or VTI or `package.json` and `tsconfig.json/jsconfig.json` do not exist at project root, you can use `coffeesense.config.js` for advanced setting.

Expand Down
4 changes: 3 additions & 1 deletion server/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export interface LSPConfig {
lspPort: number;
logLevel: 'INFO' | 'DEBUG';
};
fileExtensions: string[];
};
}

Expand All @@ -40,7 +41,8 @@ export function getDefaultLSPConfig(): LSPFullConfig {
lspPath: '',
lspPort: -1,
logLevel: 'INFO'
}
},
fileExtensions: []
},
typescript: {
tsdk: null
Expand Down
3 changes: 2 additions & 1 deletion server/src/services/EnvironmentService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ const setConfig = (config: LSPFullConfig) => {
// so anything other than *.ext is ignored.
// Other IDEs would not even have this config option at all.
extension_match.match(/^\*\.[a-zA-Z_0-9-]+$/))
.map(dot_ext => dot_ext.slice(2))
.map(dot_ext => dot_ext.slice(2)),
...$config.coffeesense.fileExtensions
])]
}

Expand Down

0 comments on commit 1514bd4

Please sign in to comment.