File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1313// limitations under the License.
1414
1515import * as vscode from "vscode" ;
16- import * as path from "path" ;
1716import { buildifierLint } from "./buildifier" ;
18- import { BazelWorkspaceInfo } from "../bazel" ;
1917import { ILogger } from "../extension/logger" ;
2018
2119/**
@@ -86,23 +84,11 @@ export class BuildifierDiagnosticsManager implements vscode.Disposable {
8684 if ( document . languageId === "starlark" ) {
8785 this . logger . logDebug ( `Updating diagnostics for ${ document . uri . fsPath } ` ) ;
8886
89- const workspaceInfo = BazelWorkspaceInfo . fromDocument ( document ) ;
90- if ( ! workspaceInfo ) {
91- this . logger . logDebug (
92- "No workspace info found for document" ,
93- false ,
94- document . uri . fsPath ,
95- ) ;
96- return ;
97- }
98- const workspaceRelativePath = path . relative (
99- workspaceInfo . bazelWorkspacePath ,
100- document . uri . fsPath ,
101- ) ;
87+ const absolutePath = document . uri . fsPath ;
10288
10389 const warnings = await buildifierLint (
10490 document . getText ( ) ,
105- workspaceRelativePath ,
91+ absolutePath ,
10692 "warn" ,
10793 ) ;
10894 this . logger . logDebug ( `Found ${ warnings . length } warnings` ) ;
Original file line number Diff line number Diff line change 1313// limitations under the License.
1414
1515import * as vscode from "vscode" ;
16- import * as path from "path" ;
1716import { buildifierFormat } from "./buildifier" ;
18- import { BazelWorkspaceInfo } from "../bazel" ;
1917import { getBuildifierFixOnFormat } from "../extension/configuration" ;
2018import { ILogger } from "../extension/logger" ;
2119
@@ -38,23 +36,11 @@ export class BuildifierFormatProvider
3836 this . logger . logDebug ( `Formatting document: ${ document . uri . fsPath } ` ) ;
3937
4038 const fileContent = document . getText ( ) ;
41- const workspaceInfo = BazelWorkspaceInfo . fromDocument ( document ) ;
42- if ( ! workspaceInfo ) {
43- this . logger . logDebug (
44- "No workspace info found for document during formatting" ,
45- false ,
46- document . uri . fsPath ,
47- ) ;
48- return [ ] ;
49- }
50- const workspaceRelativePath = path . relative (
51- workspaceInfo . bazelWorkspacePath ,
52- document . uri . fsPath ,
53- ) ;
39+ const absolutePath = document . uri . fsPath ;
5440 try {
5541 const formattedContent = await buildifierFormat (
5642 fileContent ,
57- workspaceRelativePath ,
43+ absolutePath ,
5844 getBuildifierFixOnFormat ( ) ,
5945 ) ;
6046 if ( formattedContent === fileContent ) {
You can’t perform that action at this time.
0 commit comments