brighterscript 0.51.4 → 0.52.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -6,6 +6,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
6
6
 
7
7
 
8
8
 
9
+ ## [0.52.0](https://github.com/rokucommunity/brighterscript/compare/v0.51.4...v0.52.0) - 2022-06-08
10
+ ### Added
11
+ - LanguageServer: Load projects based on bsconfig.json presence ([#613](https://github.com/rokucommunity/brighterscript/pull/613))
12
+ ### Changed
13
+ - upgrade to [roku-deploy@3.7.1](https://github.com/rokucommunity/roku-deploy/blob/master/CHANGELOG.md#371---2022-06-08)
14
+
15
+
16
+
9
17
  ## [0.51.4](https://github.com/rokucommunity/brighterscript/compare/v0.51.3...v0.51.4) - 2022-05-31
10
18
  ### Fixed
11
19
  - Add allowBrighterScriptInBrightScript to bsconfig.schema.json ([#610](https://github.com/rokucommunity/brighterscript/pull/610))
@@ -1,9 +1,9 @@
1
1
  import type { BsDiagnostic } from './interfaces';
2
- import type { Workspace } from './LanguageServer';
2
+ import type { Project } from './LanguageServer';
3
3
  export declare class DiagnosticCollection {
4
4
  private previousDiagnosticsByFile;
5
- getPatch(workspaces: Workspace[]): Promise<Record<string, KeyedDiagnostic[]>>;
6
- private getDiagnosticsByFileFromWorkspaces;
5
+ getPatch(projects: Project[]): Promise<Record<string, KeyedDiagnostic[]>>;
6
+ private getDiagnosticsByFileFromProjects;
7
7
  /**
8
8
  * Get a patch for all the files that have been removed since last time
9
9
  */
@@ -5,20 +5,20 @@ class DiagnosticCollection {
5
5
  constructor() {
6
6
  this.previousDiagnosticsByFile = {};
7
7
  }
8
- async getPatch(workspaces) {
9
- const diagnosticsByFile = await this.getDiagnosticsByFileFromWorkspaces(workspaces);
8
+ async getPatch(projects) {
9
+ const diagnosticsByFile = await this.getDiagnosticsByFileFromProjects(projects);
10
10
  const patch = Object.assign(Object.assign(Object.assign({}, this.getRemovedPatch(diagnosticsByFile)), this.getModifiedPatch(diagnosticsByFile)), this.getAddedPatch(diagnosticsByFile));
11
11
  //save the new list of diagnostics
12
12
  this.previousDiagnosticsByFile = diagnosticsByFile;
13
13
  return patch;
14
14
  }
15
- async getDiagnosticsByFileFromWorkspaces(workspaces) {
15
+ async getDiagnosticsByFileFromProjects(projects) {
16
16
  var _a;
17
17
  const result = {};
18
18
  //wait for all programs to finish running. This ensures the `Program` exists.
19
- await Promise.all(workspaces.map(x => x.firstRunPromise));
20
- //get all diagnostics for all workspaces
21
- let diagnostics = Array.prototype.concat.apply([], workspaces.map((x) => x.builder.getDiagnostics()));
19
+ await Promise.all(projects.map(x => x.firstRunPromise));
20
+ //get all diagnostics for all projects
21
+ let diagnostics = Array.prototype.concat.apply([], projects.map((x) => x.builder.getDiagnostics()));
22
22
  const keys = {};
23
23
  //build the full current set of diagnostics by file
24
24
  for (let diagnostic of diagnostics) {
@@ -1 +1 @@
1
- {"version":3,"file":"DiagnosticCollection.js","sourceRoot":"","sources":["../src/DiagnosticCollection.ts"],"names":[],"mappings":";;;AAGA,MAAa,oBAAoB;IAAjC;QACY,8BAAyB,GAAG,EAAuC,CAAC;IAkHhF,CAAC;IAhHU,KAAK,CAAC,QAAQ,CAAC,UAAuB;QACzC,MAAM,iBAAiB,GAAG,MAAM,IAAI,CAAC,kCAAkC,CAAC,UAAU,CAAC,CAAC;QAEpF,MAAM,KAAK,iDACJ,IAAI,CAAC,eAAe,CAAC,iBAAiB,CAAC,GACvC,IAAI,CAAC,gBAAgB,CAAC,iBAAiB,CAAC,GACxC,IAAI,CAAC,aAAa,CAAC,iBAAiB,CAAC,CAC3C,CAAC;QAEF,kCAAkC;QAClC,IAAI,CAAC,yBAAyB,GAAG,iBAAiB,CAAC;QACnD,OAAO,KAAK,CAAC;IACjB,CAAC;IAEO,KAAK,CAAC,kCAAkC,CAAC,UAAuB;;QACpE,MAAM,MAAM,GAAG,EAAuC,CAAC;QAEvD,6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AC;aACzD;SACJ;QACD,OAAO,MAAM,CAAC;IAClB,CAAC;CACJ;AAnHD,oDAmHC"}
@@ -5,18 +5,18 @@ import { ProgramBuilder } from './ProgramBuilder';
5
5
  import { Throttler } from './Throttler';
6
6
  export declare class LanguageServer {
7
7
  private connection;
8
- workspaces: Workspace[];
8
+ projects: Project[];
9
9
  /**
10
10
  * The number of milliseconds that should be used for language server typing debouncing
11
11
  */
12
12
  private debounceTimeout;
13
13
  /**
14
- * These workspaces are created on the fly whenever a file is opened that is not included
15
- * in any of the workspace projects.
16
- * Basically these are single-file workspaces to at least get parsing for standalone files.
14
+ * These projects are created on the fly whenever a file is opened that is not included
15
+ * in any of the workspace-based projects.
16
+ * Basically these are single-file projects to at least get parsing for standalone files.
17
17
  * Also, they should only be created when the file is opened, and destroyed when the file is closed.
18
18
  */
19
- standaloneFileWorkspaces: Record<string, Workspace>;
19
+ standaloneFileProjects: Record<string, Project>;
20
20
  private hasConfigurationCapability;
21
21
  /**
22
22
  * Indicates whether the client supports workspace folders
@@ -41,7 +41,27 @@ export declare class LanguageServer {
41
41
  onInitialize(params: InitializeParams): {
42
42
  capabilities: ServerCapabilities<any>;
43
43
  };
44
- private initialWorkspacesCreated;
44
+ private initialProjectsCreated;
45
+ /**
46
+ * Ask the client for the list of `files.exclude` patterns. Useful when determining if we should process a file
47
+ */
48
+ private getWorkspaceExcludeGlobs;
49
+ /**
50
+ * Scan the workspace for all `bsconfig.json` files. If at least one is found, then only folders who have bsconfig.json are returned.
51
+ * If none are found, then the workspaceFolder itself is treated as a project
52
+ */
53
+ private getProjectPaths;
54
+ /**
55
+ * Find all folders with bsconfig.json files in them, and treat each as a project.
56
+ * Treat workspaces that don't have a bsconfig.json as a project.
57
+ * Handle situations where bsconfig.json files were added or removed (to elevate/lower workspaceFolder projects accordingly)
58
+ * Leave existing projects alone if they are not affected by these changes
59
+ */
60
+ private syncProjects;
61
+ /**
62
+ * Get all workspace paths from the client
63
+ */
64
+ private getWorkspacePaths;
45
65
  /**
46
66
  * Called when the client has finished initializing
47
67
  * @param params
@@ -54,22 +74,16 @@ export declare class LanguageServer {
54
74
  /**
55
75
  * Wait for all programs' first run to complete
56
76
  */
57
- private waitAllProgramFirstRuns;
58
- /**
59
- * Create project for each new workspace. If the workspace is already known,
60
- * it is skipped.
61
- * @param workspaceFolders
62
- */
63
- private createWorkspaces;
77
+ private waitAllProjectFirstRuns;
64
78
  /**
65
79
  * Event handler for when the program wants to load file contents.
66
80
  * anytime the program wants to load a file, check with our in-memory document cache first
67
81
  */
68
82
  private documentFileResolver;
69
83
  private getConfigFilePath;
70
- private createWorkspace;
71
- private createStandaloneFileWorkspace;
72
- private getWorkspaces;
84
+ private createProject;
85
+ private createStandaloneFileProject;
86
+ private getProjects;
73
87
  /**
74
88
  * Provide a list of completion items based on the current cursor position
75
89
  * @param textDocumentPosition
@@ -82,9 +96,13 @@ export declare class LanguageServer {
82
96
  private onCompletionResolve;
83
97
  private onCodeAction;
84
98
  /**
85
- * Reload all specified workspaces, or all workspaces if no workspaces are specified
99
+ * Remove a project from the language server
100
+ */
101
+ private removeProject;
102
+ /**
103
+ * Reload each of the specified workspaces
86
104
  */
87
- private reloadWorkspaces;
105
+ private reloadProjects;
88
106
  private getRootDir;
89
107
  /**
90
108
  * Sometimes users will alter their bsconfig files array, and will include standalone files.
@@ -93,7 +111,7 @@ export declare class LanguageServer {
93
111
  *
94
112
  * Sometimes files that used to be included are now excluded, so those open files need to be re-processed as standalone
95
113
  */
96
- private synchronizeStandaloneWorkspaces;
114
+ private synchronizeStandaloneProjects;
97
115
  private onDidChangeConfiguration;
98
116
  /**
99
117
  * Called when watched files changed (add/change/delete).
@@ -108,7 +126,7 @@ export declare class LanguageServer {
108
126
  * any file changes you receive with no unexpected side-effects
109
127
  * @param changes
110
128
  */
111
- handleFileChanges(workspace: Workspace, changes: {
129
+ handleFileChanges(project: Project, changes: {
112
130
  type: FileChangeType;
113
131
  srcPath: string;
114
132
  }[]): Promise<void>;
@@ -134,14 +152,21 @@ export declare class LanguageServer {
134
152
  private transpileFile;
135
153
  dispose(): void;
136
154
  }
137
- export interface Workspace {
155
+ export interface Project {
138
156
  firstRunPromise: Promise<any>;
139
157
  builder: ProgramBuilder;
158
+ /**
159
+ * The path to where the project resides
160
+ */
161
+ projectPath: string;
162
+ /**
163
+ * The path to the workspace where this project resides. A workspace can have multiple projects (by adding a bsconfig.json to each folder).
164
+ */
140
165
  workspacePath: string;
141
166
  isFirstRunComplete: boolean;
142
167
  isFirstRunSuccessful: boolean;
143
168
  configFilePath?: string;
144
- isStandaloneFileWorkspace: boolean;
169
+ isStandaloneFileProject: boolean;
145
170
  }
146
171
  export declare enum CustomCommands {
147
172
  TranspileFile = "TranspileFile"