public bool IsMatch(CodeFileLocation location) { if (location is WorkspaceCodeFileLocation workspaceCodeFileLocation) { return(this.documentPaths.Any(m => PathMaskHelper.PathMatchMask(workspaceCodeFileLocation.DocumentPath.ToString(), m))); } throw new NotSupportedException($"{nameof(WorkspaceCodeFileLocationFilter)} supports only locations of type: {typeof(WorkspaceCodeFileLocation)}"); }
public string ResolveCodeFileName(CodeFileLocation location) { if (this.fileSystem.File.Exists(location.FilePath)) { return(this.fileSystem.Path.GetFileName(location.FilePath)); } return(null); }
public string ResolveCodeFileName(CodeFileLocation location) { var document = this.FindDocument(location); if (document != null) { return(document.Name); } return(null); }
public bool IsMatch(CodeFileLocation location) { foreach (var mask in this.pathMasks) { var startDirectoryMask = PathMaskHelper.GetAbsolutePathMask(mask, this.basePath, this.fileSystem); if (PathMaskHelper.PathMatchMask(location.FilePath, startDirectoryMask)) { return(true); } } return(false); }
public virtual CodeFile ResolveExistingCodeFile(CodeFileLocation location) { if (!this.storageHandler.CanResolveCodeFileName(location)) { throw new InvalidOperationException($"Unable to resolve code file at location ({location})"); } var codeFile = this.CreateCodeFile(this.storageHandler.ResolveCodeFileName(location)); codeFile.Location = location; this.storageHandler.ResolveCodeFile(codeFile); this.compilationHandler.Register(codeFile); return(codeFile); }
public bool IsMatch(CodeFileLocation location) { var result = false; foreach (var filter in this.Filters) { if (filter.Filter.IsMatch(location)) { result = filter.Operation == Operation.Shadow; } } return(result); }
protected string GetProjectRelativePath(CodeFileLocation location, MsBuildProject msBuildProject) { if (location is WorkspaceCodeFileLocation) { var wLocation = location as WorkspaceCodeFileLocation; if (!string.IsNullOrEmpty(wLocation.DocumentPath?.DocumentName)) { return(this.fileSystem.Path.Combine(string.Join(this.fileSystem.Path.DirectorySeparatorChar.ToString(), wLocation.DocumentPath.ProjectFolders), wLocation.DocumentPath.DocumentName)); } } else { return(PathMaskHelper.GetRelativePath(msBuildProject.FullPath, location.FilePath, this.fileSystem)); } return(null); }
private Document FindDocument(CodeFileLocation location) { Document document = null; if (location is WorkspaceCodeFileLocation) { var workspaceLocation = location as WorkspaceCodeFileLocation; if (workspaceLocation.DocumentPath != null) { document = this.workspaceManager.FindDocument(workspaceLocation.DocumentPath); } } else { document = this.workspaceManager.FindDocumentByFilePath(location.FilePath); } return(document); }
private MsBuildProject GetContainingProject(CodeFileLocation location) { if (location is WorkspaceCodeFileLocation) { var workspaceLocation = location as WorkspaceCodeFileLocation; return(this.Solution.GetProject(workspaceLocation.DocumentPath.ProjectName)); } else { if (!string.IsNullOrEmpty(location.FilePath)) { foreach (var project in this.Solution.Projects) { if (PathMaskHelper.DirectoryIsBaseOf(this.fileSystem.Path.GetDirectoryName(project.Value.FullPath), location.FilePath)) { return(project.Value); } } } } return(null); }
public bool CanResolveCodeFileName(CodeFileLocation location) { return(this.FindDocument(location) != null); }
public string ResolveCodeFileName(CodeFileLocation location) { throw new NotImplementedException(); }
public string ResolveCodeFileName(CodeFileLocation location) { return(this.workspaceFileStorageHandler.ResolveCodeFileName(location)); }
public bool CanResolveCodeFileName(CodeFileLocation location) { return(this.fileSystem.File.Exists(location.FilePath)); }
public bool CanResolveCodeFile(string language, CodeFileLocation location) { return(this.HandlerFor(language).CanResolveExistingCodeFile(location)); }
public bool CanResolveCodeFileName(CodeFileLocation location) { return(this.workspaceFileStorageHandler.CanResolveCodeFileName(location)); }
public virtual bool CanResolveExistingCodeFile(CodeFileLocation location) { return(this.storageHandler.CanResolveCodeFileName(location)); }
public WorkspaceCodeFileLocation(CodeFileLocation location) { this.FilePath = location.FilePath; }